I am working in one app to play hls streams.
The problem is that the mediaPlayerStateChanged event is fired but the event is allways 2.
This is the code I am using:
Code: Select all
class AVideoPlayerViewController: UIViewController, VLCMediaPlayerDelegate
{
.
.
.
func mediaPlayerStateChanged(aNotification: NSNotification!)
{
let currentState: VLCMediaPlayerState = mediaPlayer.state();
switch(currentState)
{
case 2:
print("mediaPlayerStateChanged -> 2...");
ActivityIndicator.stopAnimating();
ActivityIndicator.hidden = true;
break;
case VLCMediaPlayerStateError:
print("mediaPlayerStateChanged -> Error!");
break;
case VLCMediaPlayerStateEnded:
print("mediaPlayerStateChanged -> Ended!");
break;
case VLCMediaPlayerStateStopped:
print("mediaPlayerStateChanged -> Stopped!");
break;
case VLCMediaPlayerStateBuffering:
print("mediaPlayerStateChanged -> Buffering...");
ActivityIndicator.startAnimating();
ActivityIndicator.hidden = false;
break;
case VLCMediaPlayerStateOpening:
print("mediaPlayerStateChanged -> Opening...");
break;
case VLCMediaPlayerStatePaused:
print("mediaPlayerStateChanged -> Paused...");
break;
case VLCMediaPlayerStatePlaying:
print("mediaPlayerStateChanged -> Playing...");
ActivityIndicator.stopAnimating();
ActivityIndicator.hidden = true;
break;
default:
break;
}
print("VLC STATE -> \(mediaPlayer.state())")
}
I have followed the code in the examples of vlckit (specially DropIn-Player).
Thanks for any help
Sergio