Skip to content

mediaPlayerStateChanged to .played never called using delegates.

When I called mediaPlayer.play() mediaPlayerStateChanged to .playing never called so how to detect when video is started playing?

//MARK:- MediaPlayerState Delegates
    func mediaPlayerStateChanged(_ aNotification: Notification!) {
        let currentState: VLCMediaPlayerState = mediaPlayer.state
        switch currentState {
        case .stopped :
            print("Video is done playing)")
 
            if currentIndex < collectionViewItems.count-1 {
                if currentIndex >= 0 {
                    currentIndex += 1
                }
                playNextVideo()
            }
        case .ended :
            print("Video is done playing)")
 
            if currentIndex < collectionViewItems.count-1 {
                if currentIndex >= 0 {
                    currentIndex += 1
                }
                playNextVideo()
            }
            
        case .playing :
            print("Video is playing")
            self.hideIndicator()
            
        case .paused :
            print("Video is paused)")
            
        case .opening :
            print("Video is opening)")
            
        case .buffering :
            print("Video is buffering)")
            
        case .error :
            print("Video has error)")
            
        }
    }
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information