在动态代码中播放YouTube视频

时间:2015-10-20 13:26:42

标签: browser youtube livecode

我正在尝试使用浏览器实例使用EMBED代码播放YouTube视频。

You can find my sample project here

视频播放器加载正常,但是当我点击播放时,音频会通过,但图像仍为黑色。

有人能说明出了什么问题吗? (理想情况下,我最终也喜欢在移动设备上工作)。代码如下。

########### LIVECODE
global sBrowserId

on mouseUp
  repeat for each item theItem in revBrowserInstances()
      revBrowserClose theItem
   end repeat

   altBrowserOn

end mouseUp

on altBrowserOn
   put empty into tAddress
   put field "soundcloud" into PAGINAHTML
   -- We pass the windowId of the stack to revBrowser 
   put the windowid of this stack into tWinID
   -- Open the browser, using the windowId and initial url
   put revBrowserOpen(tWinID,tAddress) into sBrowserId
   revBrowserSet sBrowserId, "htmltext", PAGINAHTML

   if sBrowserId is not an integer then
      answer "Error opening browser: " & sBrowserId
      exit altBrowserOn
   end if

   -- Set some basic properties for the browser
   revBrowserSet sBrowserId, "showborder","true"
   revBrowserSet sBrowserId, "scrollbars","false"
   revBrowserSet sBrowserId, "useragent", "Mozilla/5.0 ;iPhone; CPU iPhone OS 7_1_2 like Mac OS X; AppleWebKit/537.51.2 ;KHTML, like Gecko; Version/7.0 Mobile/11D257 Safari/9537.53"
   put the rect of field "soundcloud" of this card into tRectImage
   revBrowserSet sBrowserId, "rect", tRectImage

end altBrowserOn

on altBrowserOff
   if sBrowserId is  an integer then
      revBrowserClose sBrowserId
   end if
end altBrowserOff

####### END LIVECODE


####### EMBED CODE

<html>
<head><title></title>
</head>
<body>
<iframe width="420" height="315" src="https://www.youtube.com/embed/56G8tuyez5s" frameborder="0" allowfullscreen></iframe>
</body>
</html>

########## END EMBED CODE

1 个答案:

答案 0 :(得分:0)

LC浏览器的问题之一是它没有安装h264编解码器。 YouTube的某些视频是使用此编解码器编码的,与Vimeo相同。唯一的办法就是建立自己的CEF。