In using MVC .cshtml file, trying to play a vedio which is added in application. Still the vedio buffers. What will be the issue?
Here is the code i am using
<a
onclick="navVideo('AdminRenderedFull.mp4',
'0');">Display
Video</a>
|
<a
onclick="navVideo('AdminRenderedFull.mp4',
'300');">Display
Video After 5 minutes</a>
<div>
<video
id="VideoContainer"
controls="controls"
style="width:500px;height:320px"
preload="auto">
<source
id="VideoData"
src="~/Content/create/Videos/AdminRenderedFull.mp4"
type="video/mp4"
/>
Your browser does not support the video tag.
</video>
</div>
<script
type="text/javascript">
function navVideo(fileName, pos) {
//Get Player and the source
var player = document.getElementById('VideoContainer');
var mp4Vid = document.getElementById('VideoData');
var mp4CurVid = $(mp4Vid).attr('src');
//Reload the player only if the file name changes
if (mp4CurVid != fileName) {
$(mp4Vid).attr('src',
mp4CurVid);
$(mp4Vid).attr('preload',
'auto');
player.load();
player.play();
if
(pos != 0) {
setTimeout(function
() {
player.currentTime
= pos;
player.play();
}, 1000);
}
}
else {
player.play();
player.currentTime = pos;
}
}
</script>