Keep Trying Until HLS Stream Starts - Was Working in JW6, can't seem to get it going in JW7
I have a self-hosted player for live events that are broascast in HLS .M3U8 format. I want the player to autostart. The issue is that if the stream hasn't started yet, then it just returns an error message and stops. In JW Player 6 I worked around this by intercepting the error and then telling the player to wait a few seconds and try again. Sadly this trick doesn't work in JW Player 7. Once an error is reached the player seems to ignore other commands.
Here is the code I have that was working fine on JW Player 6.
jwplayer().onError( function(event){
if (event.message == 'Cannot load M3U8: No levels in manifest' || event.message == 'Cannot load M3U8: 404 not found'){
setTimeout(function(){ jwplayer().play(true); }, 3000);
}
})
Is there a way to make this work in JW7? Is there a better method I should be using?
Thanks in advance.