When you play a video in AVPlayerViewController, the screen is completely dark.

Asked 2 years ago, Updated 2 years ago, 74 views

Playing videos in AVPlayerViewController

We have created a controller class that inherited the AVPlayerViewController and are playing it back with the following code:

self.player=[AVPlayer playerWithURL:url];
[self.player play]

When I start playing, sometimes the screen becomes completely dark and no video is displayed.The audio is playing.
Continuous reproduction or difficulty in reproducing.

iOS version: 10.0.2

Please advise me on a workaround.

ios objective-c

2022-09-30 19:40

1 Answers

The official document says not to create subclasses of AVPlayerViewController.
https://developer.apple.com/reference/avkit/avplayerviewcontroller

Do not subclass AVPlayerViewController.Overriding this class's methods is unsupported and results in undefined behavior.

Why don't you use this as a reference to implement it?
https://stackoverflow.com/a/31277658/4834226


2022-09-30 19:40

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.