0

I have made a website which we use on a TV to welcome guests/customers to our business. There's a SQL database which we write their names to be presented on the screen, and there is also a video which is playing in a different frame on the same website. This all works very well on desktop PC Chrome. But we use the built in browser in the TV (which is a business model used for stuff like this). The browser is Opera and it supports HTML5.

Problem is that after a while, can be 2 hours, can be a day, it will stop playing the video, and just show a black frame.

This is the code:

<source src="video/video1.mp4" type='video/mp4'/>

</video>

<script type='text/javascript'>

video_count =1;

videoPlayer = document.getElementById("video");



function run(){

        video_count++;

        if (video_count == 3) video_count = 1;

        var nextVideo = "video/video"+video_count+".mp4";

        videoPlayer.src = nextVideo;

        videoPlayer.play();

                videoPlayer.loop();

   };



</script>

This will play the files named video1.mp4 and video2.mp4... etc. Right now there is only one file in this folder called video1.mp4, and it will autoplay and it will loop. But it will fail to autoplay after a while and just show a black frame.

Any ideas?

Thanks!

jockebq
  • 191
  • 9

1 Answers1

0

I'd recommend looking into video events with javascript in this case if you're starting to see bugs.

For example (from Detect when an HTML5 video finishes post) you could start playing your next video like this:

<script type='text/javascript'>
    document.getElementById('myVideo').addEventListener('ended',myHandler,false);
    function myHandler(e) {
        // What you want to do after the event
    }
</script>

You could simply move on to the next video, or seek back to 0 on its timeline and play it again. The other option if you're wanting to loop 1 video, you'd be better using the loop option in your <video> tag:

<video loop>
  <source src="video/video1.mp4" type="video/mp4">
</video>
Community
  • 1
  • 1
Wakeuphate
  • 493
  • 3
  • 13