I am trying to build a really simple HTML5 video player :
HTML
<div class="col-lg-12 video">
<video id="format-video" width="100%" height="100%" loop="loop" preload="auto">
<source src="Video-AOM.mp4" type="video/mp4" />
<img src="images/fallback.jpg" />
</video>
<img class="background" src="images/video-background.jpg" />
<div class="video-run"></div>
<div class="video-play-pause"></div>
</div>
TYPESCRIPT
$(document).ready(function () {
if ($('#format-video').length > 0) {
var video = <HTMLVideoElement> document.getElementById('format-video');
video.oncanplaythrough = function () {
$('.video-run').fadeIn(200);
$('.video-run').click(function () {
$(".video .background").fadeOut(200);
$('.video-run').fadeOut(200);
$('.video-play-pause').fadeIn(200);
$('.video-play-pause').on('click',function () {
if (video.paused) {
video.play();
}
else {
video.pause();
}
})
video.play();
});
}
});
So when the video can "playthrough", a big "play" button fades in, when cliked in fades out and a small pause/play fades in.
If I click the button play/pause, the pause works but then if I click it again it either plays only few seconds and freezes or nothing happens.
I am testing on Chrome 40.0.2214.91 m.
I tried to set-up preload="none" as suggested there :HTML5 video controls - Cannot play after pause in chrome only but no success.
Not sure if there is a solution.