gpt4 book ai didi

angularjs - Jwplayer - 错误 : jwplayer(. ..).setup 不是函数

转载 作者:行者123 更新时间:2023-12-05 01:45:46 29 4
gpt4 key购买 nike

我必须在弹出窗口中显示 jwplayer,对于我使用 ngDialog(angular) 的弹出窗口,ngDialog 的代码如下:

$scope.showVideoPlayerPopup = function(video_path)
{
$scope.ngDialog = ngDialog;
ngDialog.open({
animation: true,
scope:$scope,
template:'<div id="video_popup"></div>',
plain: true,
//className: 'ngdialog-theme-default',
closeByDocument: true
//backdrop : 'static'
});
playVideo(video_path);
}

上面调用的播放视频函数包含jwplayer的代码,如下:

<script>
function playVideo(video_path)
{
jwplayer("video_popup").setup({
file: video_path,
width: "600px",
height: "600px",
stretching: "bestfit",
});
}

</script>

当我对没有弹出窗口的简单 html 代码使用相同的 jwplayer 代码时,它工作正常,但我尝试将我的 html 放在弹出窗口中,它给我以下错误:

Error: jwplayer(...).setup is not a function

更新

我包含的文件:

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

最佳答案

  1. 确保包含 jwplayer src(您可能已经包含但以防万一:)

    更新 11/2021

    请参阅 Cloud-hosted 部分在文档页面上Add a player library .这将需要 obtaining a JWPlayer account .

    1. From your Player Downloads & Keys page, scroll down to the Cloud Hosted Player Libraries section.

    2. In the Cloud Hosted Player Libraries section, select a Player Title from the dropdown menu.

    3. Copy the Cloud Player Library Url.

    4. Within the <head> of your page, copy and paste the URL to the player library.

      <script src="{cloud_hosted_player_library_url}"></script>
  2. 确保面板在调用 setup 之前已加载功能。一种方法是为 ngDialog.opened 注册一个事件监听器。来自 ngDialog(参见 EventsngDialog readme 部分):

    $scope.$on('ngDialog.opened', function (e, $dialog) {
    playVideo();
    });

关于angularjs - Jwplayer - 错误 : jwplayer(. ..).setup 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40078984/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com