Reputation: 191
In my swift project, I implement a VLC Player and an activity indicator in it. And every time when I load remote streaming video failed, it will popup a alert view said Your input can't be opened
. I want to catch this alertView and stop my activity indicator, but don't know how.
I've search all the delegate, like VLCMediaDelegate and VLCMediaPlayerDelegate, all of it can't reach my requirement.
Could someone tell me how to stop the activity indicator when alert show?
Upvotes: 0
Views: 1267
Reputation: 566
From this answer (Swift-ified):
var player: VLCMediaPlayer = VLCMediaPlayer(options: ["--extraintf="])
I had previously compiled it myself, like the accepted answer, but that's a PITA.
Upvotes: 0
Reputation: 191
Finally, I found out a solution for this.
Add ViewController as VLCMediaPlayerDelegate, and implement the method mediaPlayerStateChanged
Inside this method, I found that when the alert popup, the state of VLCPlayer will equal 0!
The code is like this:
public func mediaPlayerStateChanged(aNotification: NSNotification!) {
if self.vlcPlayer.state.rawValue == 0
{
liveLoadingIndicator.stopAnimating()
}
}
Hope this could help someone like me.
Upvotes: 1