简体   繁体   English

安装功能上的JWPlayer 7错误不起作用

[英]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. 我最近从5.10升级到7.22,现在托管播放器并自己归档。

In my <head> is have the following: 在我的<head>中具有以下内容:

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

The in the <body> I have the actual setup call: <body>我有实际的设置调用:

<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'); 尝试var playerInstance = jwplayer('actualvideo'); instead of var playerInstance = jwplayer('#actualvideo'); 而不是var playerInstance = jwplayer('#actualvideo');

The # is wrong. #错误。 It seems not to be an jquery selector and the vanilla getElementById() is used ;) 似乎不是jquery选择器,并且使用了普通的getElementById() ;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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