在 Ionic Framework 应用程序中在浏览器中播放 youtube 视频但不在 android 设备中
In Ionic Framework App playing youtube video in browser but not in android device
在一个简单的 Ionic 应用程序中,我必须播放一个 youtube 视频。它在浏览器中运行良好,但在 运行 实际 android 设备上运行良好。
我参考了 http://plnkr.co/edit/XmyAhE?p=preview
中的代码
我在我的 ionic 应用程序中使用了以下代码,
<ion-view view-title="{{navTitle}}">
<ion-content has-header="true" padding="true">
<div class="list card">
<div class="item item-divider">
<i class="ion-videocamera"></i>
Video
</div>
<div class="padding">
<object width="100%" height="150">
<param name="movie" value="https://www.youtube.com/v/WzhW20hLp6M?version=3&hl=uk_UA&rel=0"></param>
<param name="allowFullScreen" value="true"></param
<param name="allowscriptaccess" value="always"></param>
<embed src="https://www.youtube.com/v/WzhW20hLp6M?version=3&hl=uk_UA&rel=0" type="application/x-shockwave-flash" width="100%" height="150" allowscriptaccess="always" allowfullscreen="true"></embed>
</object>
</div>
</div>
</ion-content>
</ion-view>
这是浏览器输出屏幕:
并在 Android 设备中输出屏幕:
请帮帮我。
考虑使用 iframe 代替 <object></object
。这是 instructions on how to get the iframe from a youtube video. The upside of using the iframe method is if the browser supports html5, it will use html5 to play the video. It also supports various other methods of playback if the web browser supports it. Here is some further reading on youtube video playback.
我已经在我的应用程序中使用添加插件解决了我的问题
cordova plugin add https://github.com/apache/cordova-plugin-whitelist.git
在一个简单的 Ionic 应用程序中,我必须播放一个 youtube 视频。它在浏览器中运行良好,但在 运行 实际 android 设备上运行良好。 我参考了 http://plnkr.co/edit/XmyAhE?p=preview
中的代码我在我的 ionic 应用程序中使用了以下代码,
<ion-view view-title="{{navTitle}}">
<ion-content has-header="true" padding="true">
<div class="list card">
<div class="item item-divider">
<i class="ion-videocamera"></i>
Video
</div>
<div class="padding">
<object width="100%" height="150">
<param name="movie" value="https://www.youtube.com/v/WzhW20hLp6M?version=3&hl=uk_UA&rel=0"></param>
<param name="allowFullScreen" value="true"></param
<param name="allowscriptaccess" value="always"></param>
<embed src="https://www.youtube.com/v/WzhW20hLp6M?version=3&hl=uk_UA&rel=0" type="application/x-shockwave-flash" width="100%" height="150" allowscriptaccess="always" allowfullscreen="true"></embed>
</object>
</div>
</div>
</ion-content>
</ion-view>
这是浏览器输出屏幕:
并在 Android 设备中输出屏幕:
请帮帮我。
考虑使用 iframe 代替 <object></object
。这是 instructions on how to get the iframe from a youtube video. The upside of using the iframe method is if the browser supports html5, it will use html5 to play the video. It also supports various other methods of playback if the web browser supports it. Here is some further reading on youtube video playback.
我已经在我的应用程序中使用添加插件解决了我的问题
cordova plugin add https://github.com/apache/cordova-plugin-whitelist.git