Youtube_player_flutter: [BUG] Crash on iOS 14.5

Created on 28 Apr 2021  路  21Comments  路  Source: sarbagyastha/youtube_player_flutter

I think the player crash when testing on iOS 14.5,
can you give an update for this issue? I'm still using version non null safety, it will be good if your release the version on non null safety.

Or give me instructions how to fix this

bug

Most helpful comment

flutter_inappwebview plugin causes the problem.
This is just a workaround, I modified method parse(options: [String: Any?]) in Options.swift as below, and it works.

    func parse(options: [String: Any?]) -> Options {
        for (key, value) in options {
            if !(value is NSNull) {
                if self.responds(to: Selector(key)) {
                    self.setValue(value, forKey: key)
                }
            }
        }
        return self
    }

All 21 comments

There is nothing error in console when crash happend, so i don't know why

This is crash log when i debug with XCode

Screen Shot 2021-04-28 at 14 44 12

The problem is on dependency plugin - 'userAgent' has not parsed.

also got same problem

flutter_inappwebview plugin causes the problem.
This is just a workaround, I modified method parse(options: [String: Any?]) in Options.swift as below, and it works.

    func parse(options: [String: Any?]) -> Options {
        for (key, value) in options {
            if !(value is NSNull) {
                if self.responds(to: Selector(key)) {
                    self.setValue(value, forKey: key)
                }
            }
        }
        return self
    }

oh, waw.
could you share more about this @NAKANISYNTH , it would be very helpful? where do I find Options.swift?

@gyamoto Yes, that's it!
@muhajirdev Option.swift is in dependency plugin 'flutter_inappwebview'. So open Runner.xcworkspace in your repo and search Option.swift on it.

Thanks @NAKANISYNTH . It work!

Is there an issue in https://github.com/pichillilorenzo/flutter_inappwebview/ to address this?

hey guys, I am not really sure where to find it.

image

image

is it somewhere here?

I can't find flutter_inappweview

@muhajirdev Press Shift + Command + O and search for Options.swift.

I can't find it too, any idea why?
image

I am using this plugin, version 6.1.1 btw

Also I tried to list the external dependencies here, in Android studio. Looks like youtube_player_flutter and flutter_inappwebview are not here. But it's in my pubpsec.yaml

image

flutter_inappwebview plugin causes the problem.
This is just a workaround, I modified method parse(options: [String: Any?]) in Options.swift as below, and it works.

    func parse(options: [String: Any?]) -> Options {
        for (key, value) in options {
            if !(value is NSNull) {
                if self.responds(to: Selector(key)) {
                    self.setValue(value, forKey: key)
                }
            }
        }
        return self
    }

This problem fixed when i try this one, thank youu so much!

you can forceHD: true, as well while creating YoutubePlayerController and passing YoutubePlayerFlags object as temporary solution.

It's also related to applaypay as per the author of pichillilorenzo/flutter_inappwebview see

I faced the same issue and it was solved once flutter is upgraded to 2.0

In our case, we encountered a crash in iOS 14.5 while using Flutter 2.2 and version 7.0.0+7 of the package. Upgrading to 8.0.0 fixes the crash.

Screenshot 2021-09-01 at 10 40 55 AM
in case if you guys are unable to find Options.swift, try to search like this

Another way to find this file from vscode is:

Open dependencies tab, and search for flutter_inappwebview

Screen Shot 2021-11-04 at 08 07 17

To anyone that is having this issue on youtube_player_iframe, I fixed it.

Just add

youtube_player_iframe:
    git: 
      url: https://github.com/thiagocarvalho0877/youtube_player_flutter.git
      path: ./packages/youtube_player_iframe
      ref: fix-inappwebview

https://github.com/thiagocarvalho0877/youtube_player_flutter

Was this page helpful?
0 / 5 - 0 ratings