是否有基于CE-HTML的工具可在智能电视上播放视频? [英] Is there a CE-HTML based tool for playing video on Smart TV?

查看:129
本文介绍了是否有基于CE-HTML的工具可在智能电视上播放视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找要在CE-HTML页面中使用的视频播放器工具(如jwplayer).使用智能电视应用程序的开发人员通常在播放视频时使用以下简单和基本的代码

I'm looking for a video player tool(like jwplayer) that I'm going to use in CE-HTML pages. The developers who works with Smart tv applications commonly uses the following simple and basic codes in playing videos

<?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的工具可在智能电视上播放视频?

Is there a CE-HTML based tool for playing video on Smart TV ?

推荐答案

确定可以使用JWPplayer! JWPlayer的额外好处是,如果您购买了Pro版本,则可以在视频区域内禁用右键单击,如果您制作的SmartTV应用程序包含鼠标集成功能,并且在屏幕上弹出一个独立的弹出窗口,则该功能很有用. >

Sure you can use JWPplayer! The added bonus with JWPlayer is that if you buy the Pro version you can disable right click inside the video area, which could be useful if you make a SmartTV app which includes mouse integration and it breaks on an unaffiliated pop up on screen.

  1. 在Jwplayer网站上注册一个API帐户
  2. 获取JS
  3. 将JS放置在应用程序的文件夹结构中.可能在您的main.js文件的同一文件夹中
  4. 在您的index.html中创建一个名为videoPlayerBox的div,将在该div中加载播放器.
  5. 通过调用此函数来初始化播放器:

  1. Register for an API account on Jwplayer website
  2. Get the JS
  3. Place the JS in the folder structure of your app. Possibly in the same folder of your main.js file
  4. Create a div in your index.html named videoPlayerBox, the player will be loaded in this div.
  5. Initialize the player by calling this function:

function displayVideoPlayer(url) {
jwplayer('videoPlayerBox').setup({
    file: url,
    width: '960',
    height: '540',
    events:{
    onComplete: function() {
        jwplayer().playNextVideo();
        }
    }
});

  • 然后播放,停止暂停即可播放的播放器:jwplayer.stop()jwplayer.play()等...

  • Then to play, stop pause the player you can simply do: jwplayer.stop(), jwplayer.play() and so on...

    这篇关于是否有基于CE-HTML的工具可在智能电视上播放视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆