简体   繁体   中英

JWPlayer 7 error on setup function not working

I recently upgraded from 5.10 to 7.22 and am hosting the player and files myself.

In my <head> is have the following:

<script src="https://content.jwplatform.com/libraries/secretKeyXXX.js"></script>

The in the <body> I have the actual setup call:

<div id="actualvideo"></div>
<div class="video-controls">
    <span class="playbtn">Play</span>
    <span class="length">
        <span class="elapsed"></span>&nbsp;/&nbsp;<span class="totaltime"></span>
    </span>
    <span class="captioning">CC</span>
    <span class="fullscreen">Fullscreen</span>
</div>
<script>
    $(document).ready(function () {
        var playerInstance = jwplayer('#actualvideo');
        playerInstance.setup({
            file: 'https://s3.amazonaws.com/urlpath/@content["FileName"]',
            image: '@content["Image"]',
            width: 640,
            height: 360,
            title: 'Basic Video Embed',
            description: 'A video with a basic title and description!',
            mediaid: '123456'
        });
        $('.video-controls .playbtn').on('click', function (e) {
            console.log('inside');
            playerInstance.pause();
        });
    });
</script>

But it's resulting with this error:

Uncaught TypeError: playerInstance.setup is not a function

And I can't figure out why. I've set it up as described on their website .

Try var playerInstance = jwplayer('actualvideo'); instead of var playerInstance = jwplayer('#actualvideo');

The # is wrong. It seems not to be an jquery selector and the vanilla getElementById() is used ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM