Can YouTube be embedded in Android Applications? How about WebOS or Blackberry?

↘锁芯ラ 提交于 2019-12-05 05:35:34

问题


Can YouTube videos be played from within an AndroidOS without launching the separate YouTube player? How about WebOS or Blackberry?

On the iPhone I can do this with a WebView and the embedded YouTube code and I'm weighing the possibility of porting my app to other mobile platforms. Thanks


回答1:


Yes. webview.setPluginsEnabled(true);




回答2:


You can launch the webOS YouTube player from your app in a separate card using code like:

launchYouTube: function(mediaURL)
{
  var params = {
    target: mediaURL,
    direct: true
  };
  this.controller.serviceRequest('palm://com.palm.applicationManager', {
    method:'launch',
    parameters: {
      'id': 'com.palm.app.youtube',
      'params': params
  });
}

The mediaURL parameter looks like "http://www.youtube.com/watch?v=_6U9YGDtSEs" depending on the video.

As best I can tell, the YouTube player does not support the sublaunch mechanism that allows it to be embedded as a new scene on your own app's stage.




回答3:


setPluginsEnabled is now deprecated, new method:

webView.getSettings().setPluginState( WebSettings.PluginState.ON );


来源:https://stackoverflow.com/questions/2645902/can-youtube-be-embedded-in-android-applications-how-about-webos-or-blackberry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!