我正在寻找一个我将在CE-HTML页面中使用的视频播放器工具(如jwplayer)。使用智能电视应用程序的开发人员通常在播放视频时使用以下简单和基本代码
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="application/ce-html+xml; charset=UTF-8"/>
<title>Basic CE-HTML - Basic media object</title>
<script type="text/javascript">
<![CDATA[
function handlePlayButtons(e)
{
switch (e.keyCode)
{
case VK_PLAY:
video.play(1);
break;
case VK_STOP:
video.stop();
break;
case VK_PAUSE:
video.play(0);
break;
}
}
// check the current playstate of the mediaobject
function checkPlayState()
{
switch (video.playState)
{
case 5: // finished
endOfFile();
break;
case 0: // stopped
case 6: // error
case 1: // playing
case 2: // paused
case 3: // connecting
case 4: // buffering
default:
// do nothing
break;
}
}
// called when the end of file is reached
function endOfFile()
{
// repeat
video.play(1);
}
document.onkeydown=handlePlayButtons
]]>
</script>
<![CDATA[
The video is started using the play button.
]]>
</head>
<body style="margin:0px;overflow:hidden;" onload="video.data='/click.mp4';video.play(1); video.onPlayStateChange=checkPlayState;">
<div id="mediaobject" style="position:absolute;left:0px;top:0px; width:640px;height:480px;">
</div>
</body>
</html>
是否有基于CE-HTML的工具在智能电视上播放视频?
答案 0 :(得分:1)
当然可以使用JWPplayer! JWPlayer的额外好处是,如果您购买专业版,您可以在视频区域内禁用右键单击,如果您制作一个包含鼠标集成的SmartTV应用程序,它会在屏幕上显示无关紧要的弹出窗口,这可能很有用。
main.js
文件index.html
的{{1}}中创建一个div,播放器将加载到此div中。通过调用此函数初始化播放器:
videoPlayerBox
然后播放,停止暂停您只需执行的播放器:function displayVideoPlayer(url) {
jwplayer('videoPlayerBox').setup({
file: url,
width: '960',
height: '540',
events:{
onComplete: function() {
jwplayer().playNextVideo();
}
}
});
,jwplayer.stop()
等等...