RadMediaPlayer to open a video in a new window from codebehind

2 posts, 0 answers
  1. R
    R avatar
    4 posts
    Member since:
    Feb 2013

    Posted 06 Feb 2013 Link to this post


    Hi,
    I am fairly new to Silverlight. I am trying to use RadMediaPlayer to open a video in a new window from codebehind. is this even possible?
    Apppreciate your help. Thanks

    Below is my code:
    RadMediaPlayer newPlayerVideo = new RadMediaPlayer();
                RadMediaItem mediaItem = new RadMediaItem();
     
                //mediaItem.Source = new Uri("video_SAV.mp4", UriKind.Relative);
     
                //mediaItem.Source = new Uri("Hot-Line Cut.wmv", UriKind.Relative);
                mediaItem.Source = new Uri("/Images/Wildlife.wmv", UriKind.Relative);
                mediaItem.BindingValidationError += new EventHandler<ValidationErrorEventArgs>(mediaItem_BindingValidationError);
                newPlayerVideo.Items.Add(mediaItem);
                newPlayerVideo.SelectedIndex = 0;
                newPlayerVideo.AutoPlay = true;
                newPlayerVideo.IsFullScreen = true;
                newPlayerVideo.Height = 545;
                newPlayerVideo.MediaOpened += new EventHandler<Telerik.Windows.RadRoutedEventArgs>(newPlayerVideo_MediaOpened);
                newPlayerVideo.BindingValidationError += new EventHandler<ValidationErrorEventArgs>(newPlayerVideo_BindingValidationError);
                this.LayoutRoot.Children.Add(newPlayerVideo);

  2. R
    R avatar
    4 posts
    Member since:
    Feb 2013

    Posted 06 Feb 2013 Link to this post

    Nevermind. I got the answer. i am using RadWindow.
    See Code Below:
    RadWindow window = new RadWindow() {MinHeight = 200,MinWidth = 300,MaxWidth = 600, MaxHeight = 500, WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterScreen, Header = "Proposal Demo" };
                RadMediaPlayer radMediaPlayer = new RadMediaPlayer();
                RadMediaItem mediaItem = new RadMediaItem();
     
                radMediaPlayer.AutoPlay = true;
     
                //mediaItem.Source = new Uri("http://localhost:33601/Videos/Wildlife.wmv");
                //mediaItem.Source = new Uri("/WebProposal/Videos/Wildlife.wmv", UriKind.Relative);
                //mediaItem.Source = new Uri("/../Videos/Wildlife.wmv",UriKind.Relative);   
                string text = Application.Current.Host.Source.AbsoluteUri.Replace(Application.Current.Host.Source.AbsolutePath, "/Videos/Wildlife.wmv");
                mediaItem.Source = new Uri(text);
              
                radMediaPlayer.Items.Add(mediaItem);
                radMediaPlayer.SelectedItem = mediaItem;
                window.Content = radMediaPlayer;
                window.Show();
  3. DevCraft banner
Back to Top