本文介绍了嵌入jwplayer到jQuery对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要把我的jwplayer放在Dialog里面,我做了如何创建其他对话框,但是失败了TypeError:jwplayer(...),安装程序不是一个功能
I need to put my jwplayer inside of a Dialog, and I did it as how I created other dialogs, but it failed with error "TypeError: jwplayer(...).setup is not a function"
这是我的代码如下:
function popupVideoPlayDialog(urlToRenderedVideo, thumbnailUrl, cvId) {
// create dialog frame div for dialog
var dialogFrame = document.createElement('div');
dialogFrame.setAttribute('id', 'videoPlayDialog');
// Load Videos
loadVideoByUrlWithSize( "videoPlayDialog", urlToRenderedVideo, thumbnailUrl, 640, 480);
$dialog = $(dialogFrame).dialog({
width : 640,
height : 480,
modal : true,
show : {
effect : 'clip',
duration : 500
},
hide : {
effect : 'clip',
duration : 500
},
title : 'video play',
buttons: [
{text: "Cancel", click: function() {$(this).dialog("close")}}
]
});
return false;
}
function loadVideoByUrlWithSize(elementId, videoUrl, videoThumbnail, width, height) {
jwplayer(elementId).setup({
file : videoUrl,
image : videoThumbnail,
width : width,
height : height
});
}
推荐答案
对不起,错误。
我调用loadVideoByUrlWithSize加载视频的方式是不正确的,因为在创建或打开对话框之前不应该这样做。
The way I call loadVideoByUrlWithSize to load video is not correct, since this should not be done before the dialog created or opened.
这是我的解决方案,希望它有助于:
Here is my solution, hope it helps:
$dialog = $(dialogFrame).dialog({
width : 640,
height : 480,
modal : true,
**open: function(){loadVideoByUrlWithSize( "videoPlayDialog", urlToRenderedVideo, thumbnailUrl, 640, 480);},**
show : {
effect : 'clip',
duration : 500
},
hide : {
effect : 'clip',
duration : 500
},
title : 'video play',
buttons: [
{text: "Cancel", click: function() {$(this).dialog("close")}}
]
});
return false;
这篇关于嵌入jwplayer到jQuery对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!