Hi everyone,
I have a problem while embeding youtube video in my ionic app.
It works on chrome or firefox and in the android simulator, but it doesn’t work on the iphone when I install on it…
$scope.video= $sce.trustAsResourceUrl('https://www.youtube.com/embed/hsc2bhCW80Y');
Any help is welcome
I have found the solution, it finally works on iphone.
First install :
ionic plugin add https://github.com/apache/cordova-plugin-whitelist.git
then in your config.xml file, authorized youtube url :
<allow-navigation href="*.youtube.com" />
Then in your controller :
app.controller('ArtistCtrl', ['$scope', '$stateParams', '$http','$sce', function($scope, $sce) { $scope.video = $sce.trustAsResourceUrl(url); }]);
And your view :
<iframe width="100%" height="auto" src="{{video}}" frameborder="0" allowfullscreen></iframe>
Enjoy !