How to play YouTube videos inside Meteor in Cordova?

只谈情不闲聊 提交于 2019-12-23 05:08:08

问题


I'm building a Meteor app that will be deployed to both iOS and Android. Some of the pages have an embedded YouTube player.

Locally and when deployed to Galaxy, the YouTube videos play without a hitch. When built for iOS, the videos do not play. When built for Android, the videos do play.

On iOS, nothing shows, though the iFrame that's supposed to hold the video is rendered. That is, an empty space is shown.

In mobile-config.js I have tried

App.accessRule('*://*.youtube.com/*');
App.accessRule('*://*.googlevideo.com/*');

and

App.accessRule('https://*.googlevideo.com/*', { type: 'navigation' } );
App.accessRule('https://*.youtube.com/*', { type: 'navigation' } );

But, for iOS, this makes no difference.

How to get YouTube videos playing in a Meteor app, built on Cordova, on iOS?


回答1:


Try to edit your mobile-config.js from

App.accessRule('https://*.youtube.com/*', { type: 'navigation' } );

to

App.accessRule('*://*youtube.com', 'navigation');



回答2:


The crux to solving this was using a particular Cordova package.enter link description here, installing it with:

meteor add cordova:com.bunkerpalace.cordova.youtubevideoplayer@https://github.com/Glitchbone/CordovaYoutubeVideoPlayer.git#765b5954e78ecf7950099c10bfe5f81133f8f396

I did not test if the access rules were necessary.



来源:https://stackoverflow.com/questions/44170489/how-to-play-youtube-videos-inside-meteor-in-cordova

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