Glitchbone / CordovaYoutubeVideoPlayer

Play Youtube Videos in a native Video Player on Android & iOS
MIT License
83 stars 133 forks source link

Error on Android 5.1 #10

Open dapearce opened 9 years ago

dapearce commented 9 years ago

Hi, this is working on older versions of android but getting a "Can't play this video." error when trying to use it in Android 5.1. Any idea what's going on?

cdarken commented 9 years ago

Yeah, same for me.

mparpaillon commented 9 years ago

Idem

matteodesanti commented 9 years ago

Same, sadly

JerryBels commented 8 years ago

+1

hryamzik commented 8 years ago

The workaround is to check device type and version:

  $scope.fallBackToUrl = function()
  {
    version = ionic.Platform.version();
    return ionic.Platform.isAndroid() && ( version >= 5 || version === 0 )
  }

And use ng-if:

<ion-item ng-if="fallBackToUrl()"
JerryBels commented 8 years ago

@hryamzik thanks, but what to do when the version is wrong ? I can't let the app do anything :/

hryamzik commented 8 years ago

@JerryBels

    <div class="video-container">
      <iframe ng-src="{{getIframeSrc(video.snippet.resourceId.videoId)}}" frameborder="0" allowfullscreen></iframe>
    </div>
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    padding-top: 30px; height: 0; overflow: hidden;
}

.video-container iframe, .video-container object, .video-container embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
.controller('VideoDetailCtrl', function($scope, $stateParams, $sce, YouTubeService) {
<...>
  $scope.getIframeSrc = function (videoId) {
    return $sce.trustAsResourceUrl('http://www.youtube.com/embed/' + videoId + '?autoplay=1');
  };

})
JerryBels commented 8 years ago

Thanks, will try that

bmcharg commented 8 years ago

Getting the same issue here on 5.0.2. Is this repo still under active development?

Glitchbone commented 8 years ago

Hi guys,

Sorry for the so late reply... I don't have any device running on 5.1 to test it and don't have the time to dive into Open Youtube Activity source code for now.

ivansifrim commented 8 years ago

Hi everyone - I'm desperately trying to find a solution for this problem. Does anyone have any advice? Is there another plugin that works well for android? Didn't think I would have to but I will pay for a stable plugin. Please help as my app has this bug on production

vespino commented 8 years ago

Looking for a solution too. This plugin works great on iOS, but doesn't play on Android 5.1.1.

vespino commented 8 years ago

Can we each donate 25$ to @Glitchbone so he can buy a phone which supports a newer version of Android and fix the issue? I would love the plugin to work on Android again and would also love to see it on NPM!

@Glitchbone how much would you need to continue this project?

ivansifrim commented 8 years ago

For anyone else struggling, we got around this issue by using the iframe player api, wrapped in a directive found here:

https://github.com/brandly/angular-youtube-embed

So far it's working out as planned. Good luck and let me know if I can be of more help

Glitchbone commented 8 years ago

Sorry guys but I won't be able to solve this issue. I just made the bridge between cordova and OpenYoutubeActivity which doesn't work anymore since Android 5. I didn't find any alternative for now..

vespino commented 8 years ago

Too bad. I'm using this plugin for Android in the meanwhile: https://github.com/dawsonloudon/VideoPlayer/tree/5d1015ce79e81800009bc7988d242c593b2d51a1

@Glitchbone will you bring the plugin to NPM/iOS only?

Silvercast commented 8 years ago

love to see it works with both iOS and Android 3.x+ (including 5)

sandeshbsuvarna commented 7 years ago

Use this plugin https://github.com/d0cz/CordovaYoutubeVideoPlayer