
jwplayer.js not being acknowledged (TypeError: jwplayer(...).setup is not a function)
Hi I have had this code working previously in another website.
If you visit the website, you can see in the sourcecode, the JS files are being called.
When I run the page, I get this error " jwplayer(...).setup is not a function"
So it's not finding the jwplayer function? what it calls inside the js files correct?
Here's my code located currently in the footer:
<code> <script>
function jwpf(url = '#', vidid = 'jwid', width = 710, height = 430, stoptime = 'all', pretitle = 'Loading the player...', image = '#') {
$atts = {
stoptime : stoptime,
width : width,
height : height,
url : url,
pretitle : pretitle,
image : image,
vidid : vidid
};
setStopTime = $atts['stoptime'];
jwplayer("jwid").setup({
file: "#",
height: $atts['height'],
width: $atts['width'],
image: $atts['image']
});
if (setStopTime != "all") {
jwplayer().onTime(function(){
var currentPosition = jwplayer().getPosition();
if (currentPosition >= setStopTime) {jwplayer($atts['vidid']).stop(); }
}); };
return $atts['vidid'];
};
$("#articles-content").html(jwpf());
</script>
</code>
The return is for test purposes. Once I get the bakcend working without error, I'll add the front end in.