question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[4.x.x] YoutubeVideoPlayer + iOS 13 - App is crashing when playing a youtube video

See original GitHub issue

Bug Report

Ionic version: 4.9.0

Current behavior: The app is crashing in iOS 13 when a youtube video is played. It was working fine in iOS 12 or earlier versions.

Expected behavior: The app does not crash in iOS 13 when a youtube video is played.

Steps to reproduce:

import {YoutubeVideoPlayer} from '@ionic-native/youtube-video-player/ngx';

export class MyPage {

    constructor(
        private youtube: YoutubeVideoPlayer
    ) {
       ...
    }
    ...
    playYouTubeVideo(videoId: string) {
         this.youtube.openVideo(videoId);
    }
}

Other information:

The console outputs the following error:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'MPMoviePlayerViewController is no longer available. Use AVPlayerViewController in AVKit.'

Ionic info:

Ionic:

   Ionic CLI                     : 5.4.2
   Ionic Framework               : @ionic/angular 4.9.0
   @angular-devkit/build-angular : 0.801.3
   @angular-devkit/schematics    : 8.3.3
   @angular/cli                  : 8.3.3
   @ionic/angular-toolkit        : 2.0.0

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : ios 5.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 16 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.8 

System:

   Android SDK Tools : 26.1.1
   ios-deploy        : 1.9.4
   ios-sim           : 8.0.1
   NodeJS            : v10.14.2
   npm               : 6.4.1
   OS                : macOS Mojave
   Xcode             : Xcode 11.2 Build version 11B41

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
abomadicommented, Oct 13, 2019

Try to use this plugin, it did handle 13 OS, i have done a new fix to this plugin ionic cordova plugin rm cordova-plugin-youtube-video-player ionic cordova plugin add https://github.com/abomadi/CordovaYoutubeVideoPlayer

2reactions
KyDenZcommented, Oct 14, 2019

@rebekris in template HTML :

<iframe
  [src]="urlSecurized"
  frameborder="0"
  allowfullscreen
  allowtransparency
  allow="autoplay"
></iframe>

In Typescript :

urlSecurized: SafeResourceUrl;

constructor(private sanitizer: DomSanitizer) {
  this.urlSecurized = this.sanitizer.bypassSecurityTrustResourceUrl('https://www.youtube.com/watch?v=YwSzqeBchEc');
}

Thank @abomadi, I tried your solution with capacitor and it works well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[4.x.x] YoutubeVideoPlayer + iOS 13 - App is crashing when ...
The app is crashing in iOS 13 when a youtube video is played. It was working fine in iOS 12 or earlier versions....
Read more >
YouTube for iPhone and iPad repeatedly crashing [U: Fixed]
Over the past hour or so, some YouTube for iPhone and iPad users have reported that the app is repeatedly crashing on open....
Read more >
Top 8 Ways to Fix YouTube Keeps Crashing on iPhone After ...
1. Check Network Settings · 2. Update YouTube App · 3. Check Router Network · 4. Clear Cache on YouTube App · 5....
Read more >
YouTube acknowledges its iOS app is crashing, says it's ...
YouTube's mobile app on iOS devices is currently down for users. The company is aware of the crash and is working on fixing...
Read more >
Fixed YouTube App not loading or Crashing on iPhone with ...
Fix YouTube crashing on startup or hanging or freezing while playing videos? It happens after a major iOS 16 update due to a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found