asp.net mvc 3 - HTML5 video path confusion -
this weird 1 bare me.
i have been playing video.js , have run problem example provided.
when specifying mp4 (h264) video, using html5 video element, there confusion.
when use (absolute):
<source src="c:\<filsystempath>\media\oceans-clip.mp4" type='video/mp4' />
the video displayed, no problem. when use:
<source src="@url.content("~/media/oceans-clip.mp4")" type='video/mp4' />
the video not displayed. conclude using relative path problem when using ogv video so:
<source src="@url.content("~/media/oceans-clip.ogv")" type='video/ogg' />
it works fine.
one more annoyance - when video used flash fallback, works.
i using asp.mvc , video.js. using localhost debug.
full video tag -
<video id="example_video_1" class="video-js vjs-default-skin" controls preload="auto" width="640" height="264" poster="http://video-js.zencoder.com/oceans-clip.png" data-setup='{"example_option":true}'> <source src="@url.content("~/media/oceans-clip.ogv")" type='video/ogg' /> -- works <source src="c:\<filesystempath>\oceans-clip.mp4" type='video/mp4' /> -- works <source src="@url.content("~/media/oceans-clip.mp4")" type='video/mp4' /> -- doesn't work <source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm' /> </video>
the question - why video play absolute path not relative one?
thanks :)
because <source src="@url.content("~/media/oceans-clip.mp4")" type='video/mp4' />
renderes like:
<source src="localhost:8080/media/oceans-clip.mp4" type='video/mp4' />
and in first case, reading file drive:
<source src="c:\<filsystempath>\media\oceans-clip.mp4" type='video/mp4' />
Comments
Post a Comment