Hello everyone. I have been using a template node to load and play a video. Most times the video plays and will keep playing but occasionally and more frequently it look like the video starts but dowes not finish loading. It almost looks like it was paused. I'm wondering if I need to wait until file is loaded before playing. Here is a sample of what is in the template node. Can someone help with how to wait for a time or until file is loaded before play is executed?
<div>
<video id="video" width="95%" heigth="95%" video loop="loop"></video>
</div>
<script>
(function(scope) {
// Watch for messages being send to this template node
scope.$watch('msg', function (msg) {
if (msg) {
var video = document.getElementById('video');
video.src = msg.payload;
video.play();
}
});
})(scope);
</script>
Thanks