Skip to content

VideoPlayerView notifications don't appear to be removed #818

@sureshjoshi

Description

@sureshjoshi

I noticed that registerNotifications is called every time the player is set, which happens both on play and on reset.

    private var player: AVPlayer? {
        didSet {
            registerNotifications()
        }
    }

Should this didSet have an unregisterNotifications for when you set nil maybe?

I'm running into a problem where I incessantly have onVideoFinished called every time reset and play a video.

    func play() {
        if let player = videoView.playerLayer.player{
            player.play()
        } else {
            // First run
            videoView.isLooping = configuration?.shouldLoop ?? videoView.isLooping
            videoView.onVideoFinished = { 
                print("onVideoFinished")
            }
            videoView.play()
        }

Every time I close and open/play, I get progressively more logs of onVideoFinished

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions