问题
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