JWPlayer 7 错误设置功能不工作
JWPlayer 7 error on setup function not working
我最近从 5.10 升级到 7.22,我自己托管播放器和文件。
在我的<head>
中有以下内容:
<script src="https://content.jwplatform.com/libraries/secretKeyXXX.js"></script>
在 <body>
我有实际的设置调用:
<div id="actualvideo"></div>
<div class="video-controls">
<span class="playbtn">Play</span>
<span class="length">
<span class="elapsed"></span> / <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>
但它导致了这个错误:
Uncaught TypeError: playerInstance.setup is not a function
而且我不明白为什么。我已按照 their website.
中的说明进行设置
尝试 var playerInstance = jwplayer('actualvideo');
而不是 var playerInstance = jwplayer('#actualvideo');
#
是错误的。它似乎不是 jquery 选择器并且使用了香草 getElementById()
;)
我最近从 5.10 升级到 7.22,我自己托管播放器和文件。
在我的<head>
中有以下内容:
<script src="https://content.jwplatform.com/libraries/secretKeyXXX.js"></script>
在 <body>
我有实际的设置调用:
<div id="actualvideo"></div>
<div class="video-controls">
<span class="playbtn">Play</span>
<span class="length">
<span class="elapsed"></span> / <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>
但它导致了这个错误:
Uncaught TypeError: playerInstance.setup is not a function
而且我不明白为什么。我已按照 their website.
中的说明进行设置尝试 var playerInstance = jwplayer('actualvideo');
而不是 var playerInstance = jwplayer('#actualvideo');
#
是错误的。它似乎不是 jquery 选择器并且使用了香草 getElementById()
;)