private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
{
try
{
//radTabControlElementDetails.SelectedIndex = 2;
RadMediaItem rmItem = new RadMediaItem();
string fileName = ((HyperlinkButton)sender).Content.ToString();
rmItem.Source=
new Uri("http://servername/virtualwebname/media/" + fileName);
_currentMediaSource = rmItem.Source.ToString(); //local variable for use later if necessary.
if (fileName.ToLower().Contains("titlea"))
{
rmItem.Title =
"TitleA";
radMediaWindow.Header =
"Title A";
}
if (fileName.ToLower().Contains("titleb"))
{
rmItem.Title =
"TitleB";
radMediaWindow.Header =
"Title B";
}
if (fileName.ToLower().Contains("titlec"))
{
radMediaWindow.Header =
"Title A";
rmItem.Title =
"Title A";
}
//-----------------------------------------------------------------------
//Show the Window that the Media Player should live in...
//-----------------------------------------------------------------------
radMediaWindow.Show();
radMediaWindow.Focus(); //try to bring the window up front...doesn't seem to work...
if (radMediaPlayer.Items.Count > 0)
{
//clear out old items from the playlist...(for now, might change later)...
radMediaPlayer.Items.Clear();
}
//Add the newly selected Item to the Media Player
radMediaPlayer.Items.Add(rmItem);
//set the currentitem...autoplay should take care of the rest...
radMediaPlayer.CurrentItem = radMediaPlayer.Items[0]
as RadMediaItem;
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex.Message);
return;
}
}
Thank you.
8 Answers, 1 is accepted
Sorry for the delayed reply, we were busy with the SP2 release which will be live soon.
Sometimes MediaElements (the element that plays the video) behave unexpectedly when they are added/removed from the visual tree or when placed in a Popup. (For example images may not show in a Popup if they have not been preloaded before).
It seems this may be the case with the Window in this case. To fix this, could you turn off the auto-play and invoke the play() method yourself in a dispatcher (which will give time for all objects to initialize properly).
It will look something like:
this.Dispatcher.BeginInvoke( () => myMediaPlayer.Play());
Hopefully this will work for you,
Best wishes,
Miroslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Basically, users search for Video Elements, then we provide a Link to the Video File where it resides on a Streaming Server.
Also, when I DO get the video to play, I can't seem to "Scrub" the video(fast forward/rewind)...Is this a Media Player setting or maybe something wrong with the way I am streaming the file? We are using Windows Media Streaming services.
Thanks
The Trial version of the player is the same as the "Dev" version. As far as I know there have been no changes to the way MediaPlayer is initialized in the latest assemblies, so unfortunately you may see the same issue again.
I tried to recreate your scenario (placing the MediaPlayer in a window) and it seems to work. The media item starts playing right away. Possibly there is something I am missing.
Could you try running the attached project and replacing the media item with one of yours?
Also, could you get the attached project not to play the item?
Currently the MediaPlayer does not support fast forward/rewind. The next/prev buttons actually move to the next/previous chapter (if available). You can use the progress bar to navigate in the media item.
Sincerely yours,
Miroslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thank you very much.
Thanks...at least I can get the video to load now on it's initial load. If I can get the "scrubber" working(progress bar), I think I will be good to go.
Thanks again.
In my project I was using the latest trial DLLs, from the SP that was released a few days ago. You can download it from your client account.
I tried seeking through the video in the example project and I did not see any problems with this. Then I remembered that the video source itself may not support seeking. To check this, you can use the following code (I modified a snippet from the project I sent you)
private void Button_Click(object sender, RoutedEventArgs e) |
{ |
RadMediaItem rmItem = new RadMediaItem(); |
rmItem.Source = new Uri("http://msstudios.vo.llnwd.net/o21/mix08/08_WMVs/T19.wmv"); |
radMediaPlayer.Items.Add(rmItem); |
radMediaPlayer.CurrentItem = rmItem; |
window.Show(); |
radMediaPlayer.MediaOpened += new EventHandler<Telerik.Windows.RadRoutedEventArgs>(radMediaPlayer_MediaOpened); |
} |
void radMediaPlayer_MediaOpened(object sender, Telerik.Windows.RadRoutedEventArgs e) |
{ |
var canSeek = radMediaPlayer.MediaElement.CanSeek; |
} |
} |
If the canSeek is false, it means that the stream that is loaded does not support seeking.
Please let me know if this is the case.
Greetings,
Miroslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thanks
Mark
I have not used the IIS7 to stream content, but it seems from this thread that there is a property that can be set when creating server-side playlists, "canSeek":
http://forums.iis.net/t/1153297.aspx
I am not sure whether this will apply in your case, but hopefully you will be able to use it.
Please do come back to us if you figure out what the problem is.
Best wishes,
Miroslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.