sahin / mobileplayer-ios

:iphone: :movie_camera: A powerful and completely customizable media player for iOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'MPMoviePlayerViewController is no longer available. Use AVPlayerViewController in AVKit.'

phuoclinh opened this issue · comments

I'm using Xcode 11 and build to device iPhone X (iOS 13).
The log is:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'MPMoviePlayerViewController is no longer available. Use AVPlayerViewController in AVKit.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23b98bde __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff503b5b20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23b98a1c +[NSException raise:format:] + 188
3 MediaPlayer 0x00007fff276f18d5 -[MPMoviePlayerViewController initWithContentURL:] + 94

same problem here
crash

@mouness2020 @phuoclinh any ideas for a fix?

Since I had to use this Framework I migrated it to use a custom view with AVPlayerLayer as the backing layer.
Instead of subclassing MPMoviePlayerViewController, it now subclasses a standard UIViewController and works as expected.

Until there is an official revision, you can give it a look here

@phuoclinh @mouness2020 @nwkeeley

Thats great thank you very much @ferhatabd

Hey @ferhatabd I'm using your version, maybe it's just me but creating the MobilePlayerViewController doesn't allow me anymore to use contentURL as a parameter, is there any fixes to that?

Hi @SerxhioGugo,
Since the MPMoviePlayerViewController is not there anymore, its initializer is unavailable too.
That's why what I did was to init thew MobileViewController with the convenience init, and then set all the config parameters with the setConfig method instead. Here is how I'm using it.

can you share how you use it again? Thanks

can you share how you use it again? Thanks

Hi @KwesiCobbina
The sample ViewController is here
I updated the link, I hope it helps.