Stream player change src

#1

Hi,

I’ve got a single video player and then thumbnails that change the source of the player without reinitialising it. It works but spews out a constant stream of javascript errors in the console.

So I create a standard player using:

<stream src="xxxxx" controls id="vid"></stream>
<script data-cfasync="false" defer type="text/javascript" src="https://embed.videodelivery.net/embed/r4xu.fla9.latest.js?video=xxxxx"></script>

Then when I want to change the video I do (using jquery as I can’t get html5 video commands to work with the player except play and pause):

$("#vid").attr("src", "yyyyy");

…which changes the video but then I get:

VM30818 r4xu.fla9.latest.js:1 Uncaught TypeError: Cannot read property 'classList' of null
    at J (VM30818 r4xu.fla9.latest.js:1)
    at d.t.addClass (VM30818 r4xu.fla9.latest.js:1)
    at d.t.updateStyleEl_ (VM30818 r4xu.fla9.latest.js:1)
    at VM30818 r4xu.fla9.latest.js:7

…in the console (which fires multiple times per second). I’ve tried loading the new javascript with:

$.getScript("https://embed.videodelivery.net/embed/r4xu.fla9.latest.js?video=yyyyy");

but that doesn’t make a difference. So is there any way to change the source of the video without creating errors - the right way? I’m not familiar with how the cloudflare javascript works in the background so any help is appreciated - thanks!

Misha

0 Likes