12 Answers, 1 is accepted
0
Hi RAVINDRA,
This is why it might be better to keep your videos on the server and keep in the database only the addresses/information of the files. Then you will be able to define the RadMediaPalyer playlist using the address of each video file.
Best wishes,
Tina Stancheva
the Telerik team
The RadMediaPlayer is basically a wrapper around the Silverlight's MediaElement control. Therefore RadMediaPlayer supports the same media formats as SIlverlight's MediaElement does. You can find a full list of the supported media formats here.
In cases when you want to use a byte stream to set the RadMediaPlayer items, you can set the RadMediaPlayer.MediaElement source:
//buffer is the byte array
Stream stream =
new
MemoryStream(buffer);
mediaPlayer.MediaElement.SetSource(stream);
Unfortunately there is a known issue when setting the RadMediaPlayer source like this - a null reference exception is thrown. The item is logged in our PITS, where you can track its progress. This is why it might be better to keep your videos on the server and keep in the database only the addresses/information of the files. Then you will be able to define the RadMediaPalyer playlist using the address of each video file.
Best wishes,
Tina Stancheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Nina
Top achievements
Rank 1
answered on 08 Mar 2012, 06:59 PM
Dear Tina,
I am sorry.
Is it true? Telerik MEdia Player CANNOT play stream.
I am using Silverlight MediaPlayer from Windows.Controls to play Back stream from "TExt to Speech".
And Now try to use Silverilght Telerik MEdiaPLayer. And I got MediaElement equals NULL.
Tell me, please , Is it no chance to use Telerik for stream not for file?
THank you advanced.
Nina
I am sorry.
Is it true? Telerik MEdia Player CANNOT play stream.
I am using Silverlight MediaPlayer from Windows.Controls to play Back stream from "TExt to Speech".
And Now try to use Silverilght Telerik MEdiaPLayer. And I got MediaElement equals NULL.
Tell me, please , Is it no chance to use Telerik for stream not for file?
THank you advanced.
Nina
0
Hi Nina,
The RadMediaPlayer.MediaElement property is of type MediaElement and you should be able to use it as the MS MediaElement, which you've previously used. But in order to access the MediaElement you'll need to make sure that the RadMediaPlayer is fully initialized. For that purpose you can handle the MediaPlayer.Loaded event and get the MeidaElement in a Dispatcher like this:
Unfortunately the RadMediaPlayer issue with opening files from the client machine is still not fixed and this may cause issues while implementing your scenario.
All the best,
Tina Stancheva
the Telerik team
The RadMediaPlayer.MediaElement property is of type MediaElement and you should be able to use it as the MS MediaElement, which you've previously used. But in order to access the MediaElement you'll need to make sure that the RadMediaPlayer is fully initialized. For that purpose you can handle the MediaPlayer.Loaded event and get the MeidaElement in a Dispatcher like this:
private
void
myMediaPlayer_Loaded(
object
sender, RoutedEventArgs e)
{
Dispatcher.BeginInvoke(() =>
{
var mediaElement = (sender
as
RadMediaPlayer).MediaElement;
if
(mediaElement !=
null
)
{
}
});
}
Unfortunately the RadMediaPlayer issue with opening files from the client machine is still not fixed and this may cause issues while implementing your scenario.
All the best,
Tina Stancheva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Nina
Top achievements
Rank 1
answered on 13 Mar 2012, 02:33 PM
THanks Tina it works.
NIna
NIna
0
Barry
Top achievements
Rank 1
answered on 18 Mar 2012, 01:37 PM
Hi Tina,
I am also trying to play a media item from a byte[] stored in a database. I see that there is a known bug for some time around the mediaitem being null. I have tried to use your suggested work around but I find even on the loaded event for the radmediaplayer the mediaitem is still null.
My xaml declaration is:
<telerik1:RadMediaPlayer Canvas.Left="38" Canvas.Top="37" Height="79" Name="radMediaPlayer1" Width="287"
IsPlaylistVisible="False" FullScreenChanged="mediaPlayer_FullScreenChanged"
AutoPlay="False" CurrentStateChanged="radMediaPlayer1_CurrentStateChanged"
SelectedIndex="0" IsFullScreen="False" Background="Black" Loaded="radMediaPlayer1_Loaded">
My code behind is:
private void radMediaPlayer1_Loaded(object sender, RoutedEventArgs e)
{
Dispatcher.BeginInvoke(() =>
{
var mediaElement = (sender as RadMediaPlayer).MediaElement;
if (mediaElement != null)
{
}
});
}
I have set break points on this method and can see that the mediaitem for the player is still null even though the Loaded event has fired.
Are there any other work arounds that I can try.
regards
Barry
I am also trying to play a media item from a byte[] stored in a database. I see that there is a known bug for some time around the mediaitem being null. I have tried to use your suggested work around but I find even on the loaded event for the radmediaplayer the mediaitem is still null.
My xaml declaration is:
<telerik1:RadMediaPlayer Canvas.Left="38" Canvas.Top="37" Height="79" Name="radMediaPlayer1" Width="287"
IsPlaylistVisible="False" FullScreenChanged="mediaPlayer_FullScreenChanged"
AutoPlay="False" CurrentStateChanged="radMediaPlayer1_CurrentStateChanged"
SelectedIndex="0" IsFullScreen="False" Background="Black" Loaded="radMediaPlayer1_Loaded">
My code behind is:
private void radMediaPlayer1_Loaded(object sender, RoutedEventArgs e)
{
Dispatcher.BeginInvoke(() =>
{
var mediaElement = (sender as RadMediaPlayer).MediaElement;
if (mediaElement != null)
{
}
});
}
I have set break points on this method and can see that the mediaitem for the player is still null even though the Loaded event has fired.
Are there any other work arounds that I can try.
regards
Barry
0
Hello Barry,
We aren't aware of any workarounds. However as I am not sure how you implement your scenario, it might be better to send us a sample project demonstrating your approach. This way we'll be able to look for workarounds in your particular case.
Regards,
Tina Stancheva
the Telerik team
We aren't aware of any workarounds. However as I am not sure how you implement your scenario, it might be better to send us a sample project demonstrating your approach. This way we'll be able to look for workarounds in your particular case.
Regards,
Tina Stancheva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Naga Sridhar madiraju
Top achievements
Rank 1
answered on 16 May 2013, 09:05 AM
Hi Tina,
Can we assign multiple byte[] or Streams
Can we assign multiple byte[] or Streams
byte
[] outputBytes =
new
byte
[arrayA.Length + arrayB.Length];
Buffer.BlockCopy(arrayA, 0, outputBytes, 0, arrayA.Length);
Buffer.BlockCopy(arrayB, 0, outputBytes, arrayA.Length, arrayB.Length);
Stream msOut =
new
MemoryStream(outputBytes);
Player.MediaElement.SetSource(msOut);
I'll be reading multiple byte[], and concatenate those to player source,
the problem now is, it's just playing the first stream.
Help appreciated
Thanks,
Sridhar
0
Hello Sridhar,
RadMediaPlayer is simply a wrapper around the MediaElement control and both controls can't handle this scenario. It might be better to implement the approach we suggested in your other thread or look for a tool that allows you to merge media files. If you use a tool that merges two video files together and you give the MediaElement a proper stream of a proper media file, only then it can play and read the extended length of the movie.
Otherwise eve though you provide an extended stream, its media-related data isn't changed. The stream doesn't really represent a new (proper and longer) media file and it cannot be displayed as such by MediaElement or RadMediPlayer.
Kind regards,
Tina Stancheva
the Telerik team
RadMediaPlayer is simply a wrapper around the MediaElement control and both controls can't handle this scenario. It might be better to implement the approach we suggested in your other thread or look for a tool that allows you to merge media files. If you use a tool that merges two video files together and you give the MediaElement a proper stream of a proper media file, only then it can play and read the extended length of the movie.
Otherwise eve though you provide an extended stream, its media-related data isn't changed. The stream doesn't really represent a new (proper and longer) media file and it cannot be displayed as such by MediaElement or RadMediPlayer.
Kind regards,
Tina Stancheva
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Greg
Top achievements
Rank 1
answered on 16 Jul 2014, 12:48 AM
Hello Tina.
I wish to play video files stored on the user's local hard drive using a Silverlight OOB application and RadMediaPlayer.
I am able to play videos in the "My Videos" folder (selected using an OpenFileDialog and creating a filestream object), but not videos in other folders on the user's hard drive.
The logged-in user definitely has permission for the other folders since the videos were placed there by the user.
Can you explain why this is occurring?
Thanks,
Greg
I wish to play video files stored on the user's local hard drive using a Silverlight OOB application and RadMediaPlayer.
I am able to play videos in the "My Videos" folder (selected using an OpenFileDialog and creating a filestream object), but not videos in other folders on the user's hard drive.
The logged-in user definitely has permission for the other folders since the videos were placed there by the user.
Can you explain why this is occurring?
Thanks,
Greg
0
Hello Greg,
This is very strange because if you're able to create the stream object there shouldn't be any difference for the media player. Could you please elaborate a little bit more on your scenario:
1) What error do you get ?
2) What is your exact dll version ?
3) Are you using the same video file for the tests ?
4) Have you tried to directly use the Microsoft MediaElement ?
I've attached my test project so that you could examine it and tell us what you're doing differently.
Regards,
Zarko
Telerik
This is very strange because if you're able to create the stream object there shouldn't be any difference for the media player. Could you please elaborate a little bit more on your scenario:
1) What error do you get ?
2) What is your exact dll version ?
3) Are you using the same video file for the tests ?
4) Have you tried to directly use the Microsoft MediaElement ?
I've attached my test project so that you could examine it and tell us what you're doing differently.
Regards,
Zarko
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
Greg
Top achievements
Rank 1
answered on 20 Jul 2014, 03:59 AM
Thanks Zarko for your response.
I discovered that the problem was not the location of the video but rather the format - the player will not play MP4s. WMV plays fine from any location.
Will MP4 be supported?
Thanks!
- Greg
I discovered that the problem was not the location of the video but rather the format - the player will not play MP4s. WMV plays fine from any location.
Will MP4 be supported?
Thanks!
- Greg
0
Hello Greg,
Our RadMediaPlayer uses the Silverlight's MediaElement to play videos/music and if you can play a video with it you should be able to play it with the RadMediaPlayer also. Here you can find a list of the supported formats - Mp4 containers with H.264 codecs are supported so you should check your video file's codec.
I hope I was able to help you.
p.s. For testing I downloaded a sample mp4/h264 video from here and it was working fine so you could try this too.
Regards,
Zarko
Telerik
Our RadMediaPlayer uses the Silverlight's MediaElement to play videos/music and if you can play a video with it you should be able to play it with the RadMediaPlayer also. Here you can find a list of the supported formats - Mp4 containers with H.264 codecs are supported so you should check your video file's codec.
I hope I was able to help you.
p.s. For testing I downloaded a sample mp4/h264 video from here and it was working fine so you could try this too.
Regards,
Zarko
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.