sarbagyastha / youtube_player_flutter

A Flutter plugin for inline playback or streaming of YouTube videos using the official iFrame Player API.
https://youtube.sarbagyastha.com.np
BSD 3-Clause "New" or "Revised" License
708 stars 820 forks source link

[BUG] Crash on iOS 14.5 #487

Open yusriltakeuchi opened 3 years ago

yusriltakeuchi commented 3 years ago

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

yusriltakeuchi commented 3 years ago

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

khanhuitse05 commented 3 years ago

This is crash log when i debug with XCode

Screen Shot 2021-04-28 at 14 44 12
adaskaliuk commented 3 years ago

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

muhajirdev commented 3 years ago

also got same problem

NAKANISYNTH commented 3 years ago

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
    }
muhajirdev commented 3 years ago

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

gyamoto commented 3 years ago

This file? https://github.com/pichillilorenzo/flutter_inappwebview/blob/4469ec7/ios/Classes/Options.swift#L17-L24

NAKANISYNTH commented 3 years ago

@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.

khanhuitse05 commented 3 years ago

Thanks @NAKANISYNTH . It work!

ItsCalebJones commented 3 years ago

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

muhajirdev commented 3 years ago

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

image

image

is it somewhere here?

muhajirdev commented 3 years ago

I can't find flutter_inappweview

shahankit-dunzo commented 3 years ago

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

muhajirdev commented 3 years ago

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

yusriltakeuchi commented 3 years ago

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!

rahul-bst commented 3 years ago

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

KatyTao commented 3 years ago

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

indyfromoz commented 3 years ago

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.

Akash-Neeli commented 3 years ago

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

thiagocarvalhodev commented 3 years ago

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

thiagocarvalhodev commented 3 years ago

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