I have come across a strange behavior with RadMediaPlayer (version : 2013.3.1015.40) while specifying the relative path of a media file. If the "Source" property is set to a relative path using the Web application root operator (~), the video won't load. Instead of using the (~) operator, if I specify the relative path using ../FolderName/ then the control works as expected. The relative URL containing the Web application root operator works properly when it is set to the Path property of the MediaPlayerSource under the Sources tag.
ASPX: (Video does not load)
<
telerik:RadMediaPlayer
ID
=
"RadMediaPlayer2"
runat
=
"server"
Width
=
"500"
Height
=
"400px"
Source
=
"~/Videos/RadControls.mp4"
>
</
telerik:RadMediaPlayer
>
ASPX: (Video loads as expected)
<
telerik:RadMediaPlayer
ID
=
"RadMediaPlayer1"
runat
=
"server"
Width
=
"500"
Height
=
"400px"
>
<
Sources
>
<
telerik:MediaPlayerSource
Path
=
"~/Videos/RadControls.mp4"
/>
</
Sources
>
</
telerik:RadMediaPlayer
>
Please have a look into this complete solution where the above mentioned issue can be replicated. Also I would like to point out that if I select the media file through the controls smart tag, the relative URL generated for the Source will be having the Web application root operator (~) (check the screenshot attached) but the video wont load which seems to confuse the users.
Thanks,
Shinu.
9 Answers, 1 is accepted
Hi Shinu,
I had the same problem you described. Since I have to create the player from codebehind, my solution was like this:
player =
new
RadMediaPlayer();
player.ID =
"RadMediaPlayer1"
;
player.Title = video.Title;
MediaPlayerSource mpSource =
new
MediaPlayerSource();
mpSource.Path =
"../Video/lozinka.mp4"
;
player.Sources.Add(mpSource);
player.StartVolume = 90;
player.OnClientReady =
"playerReady"
;
player.Height = Unit.Pixel(336);
player.Width = Unit.Pixel(600);
//player.FullScreen = true;
player.HDActive =
true
;
player.VolumeButtonToolTip =
"Zvuk"
;
player.FullScreenButtonToolTip =
"Veći ekran"
;
player.Skin =
"Metro"
;
//player.ToolBar.HDButton.Style["display"] = "none";
I beleive this should be fixed by the dev team.
Thank you for bringing this problem to our attention. We are aware of the tilda problem and our developers will fix it for the upcoming releases.
Regards,
Eyup
Telerik
Also, specifying absolute path to source doesn't seem to work locally? Please clarify.
Thank you.
I have separate folder for videos under same project in Visual studio. When I set relative path to source, videos are playing. But if I store videos in different drive/another server and map path to source as virtual directory, it doesn't work. Please help. Thanks.
I'm afraid ASP.NET does not support converting physical path to an app relative one. You can check various sources over the net about this matter and verify it using a simple asp:Image or the regular HTML5 video tag:
http://www.w3schools.com/html/html5_video.asp
I hope the clarification was helpful.
Regards,
Eyup
Telerik
DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!
Hello everybody,
I am having a problem with using RadMediaPlayer, and I think that the problem is because of the file path.
My file is saved on the server but for some reason player does not want to play it. I can see all the buttons labels but the time is 0:00 and nothing happens.
When I start my application locally I get the video without any problems.
Can you tell me what can be the problem?
I am using Telerik library version 2015.2.729.40. file is .mp4 type so I think that there is some small thing that I have missed.
This is my code for playing the video:
ASPX
<div class=
"demo-container"
>
<telerik:RadMediaPlayer ID=
"RadMediaPlayer1"
runat=
"server"
AutoPlay=
"true"
Skin=
"Office2010Blue"
Visible =
"false"
>
<PlaylistSettings Mode=
"Buttons"
ButtonsTrigger=
"MouseDown"
/>
</telerik:RadMediaPlayer>
<asp:Label id=
"lblSources"
runat=
"server"
Text =
""
/>
</div>
VB
With
RadMediaPlayer1
.Visible =
True
.ObjectHeight
.ObjectWidth
With
.TitleBar
.ShareButton.Visible =
False
End
With
Dim
oMPS
As
New
Telerik.Web.UI.MediaPlayerSource
With
oMPS
.Path =
"~"
& FilePath
End
With
Dim
oMPVF
As
New
Telerik.Web.UI.MediaPlayerVideoFile
With
oMPVF
.AutoPlay =
True
.Sources.Add(oMPS)
End
With
With
.Playlist
.Add(oMPVF)
End
With
lblSources.Text = oMPS.Path.ToString
End
With
Do you have this problem on every browser or only on IE?
http://docs.telerik.com/devtools/aspnet-ajax/controls/mediaplayer/troubleshooting/playing-video-on-ie
Generally, RadMediaPlayer should be able to play any video, which is playable with the standard HTML5 video tag and even Flash videos. You can hardcode your Source path to see the result:
http://www.w3schools.com/html/html5_video.asp
Regards,
Eyup
Telerik
Hi,
Does MediaPlayerVideoFile support the path of type UNC - video files are stored in anther network drive?
Thanks,