Java Code Examples for org.videolan.libvlc.MediaPlayer#Event
The following examples show how to use
org.videolan.libvlc.MediaPlayer#Event .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VlcVideoLibrary.java From vlc-example-streamplayer with GNU General Public License v3.0 | 6 votes |
@Override public void onEvent(MediaPlayer.Event event) { switch (event.type) { case MediaPlayer.Event.Playing: vlcListener.onComplete(); break; case MediaPlayer.Event.EncounteredError: vlcListener.onError(); break; case MediaPlayer.Event.Buffering: vlcListener.onBuffering(event); break; default: break; } }
Example 2
Source File: FragmentVideoPlayer.java From uPods-android with Apache License 2.0 | 6 votes |
@Override public void onEvent(MediaPlayer.Event event) { switch (event.type) { case MediaPlayer.Event.EndReached: releasePlayer(); getActivity().onBackPressed(); break; case MediaPlayer.Event.Playing: { if (!isVideoPlayerReady) { isVideoPlayerReady = true; pbLoading.setVisibility(View.GONE); MediaItem mediaItem = UniversalPlayer.getInstance().getPlayingMediaItem(); if (mediaItem instanceof Podcast) { int position = ProfileManager.getInstance().getTrackPosition(((Podcast) mediaItem).getSelectedTrack()); if (position > 0) { mMediaPlayer.setTime(position); } } } } case MediaPlayer.Event.Paused: case MediaPlayer.Event.Stopped: default: break; } }
Example 3
Source File: AudioPlayer.java From VCL-Android with Apache License 2.0 | 6 votes |
@Override public void onMediaPlayerEvent(MediaPlayer.Event event) { switch (event.type) { case MediaPlayer.Event.Opening: mSwitchedToVideo = false; break; case MediaPlayer.Event.ESAdded: final boolean forceAudio = (mService.getCurrentMediaWrapper().getFlags() & MediaWrapper.MEDIA_FORCE_AUDIO) != 0; if (!forceAudio && !mSwitchedToVideo && event.getEsChangedType() == Media.Track.Type.Video) { mService.switchToVideo(); mSwitchedToVideo = true; } break; case MediaPlayer.Event.Stopped: hide(); break; } }
Example 4
Source File: VLCPlayerView.java From react-native-vlc-player with MIT License | 5 votes |
@Override public void onEvent(MediaPlayer.Event event) { WritableMap eventMap = Arguments.createMap(); switch (event.type) { case MediaPlayer.Event.EndReached: pausedState = false; eventMap.putBoolean(EVENT_PROP_END, true); mEventEmitter.receiveEvent(getId(), Events.EVENT_ENDED.toString(), eventMap); break; case MediaPlayer.Event.Stopped: mEventEmitter.receiveEvent(getId(), Events.EVENT_STOPPED.toString(), null); break; case MediaPlayer.Event.Playing: eventMap.putDouble(EVENT_PROP_DURATION, mMediaPlayer.getLength()); mEventEmitter.receiveEvent(getId(), Events.EVENT_PLAYING.toString(), eventMap); break; // case MediaPlayer.Event.Buffering: // mEventEmitter.receiveEvent(getId(), Events.EVENT_PLAYING.toString(), null); // break; case MediaPlayer.Event.Paused: mEventEmitter.receiveEvent(getId(), Events.EVENT_PAUSED.toString(), null); break; case MediaPlayer.Event.EncounteredError: mEventEmitter.receiveEvent(getId(), Events.EVENT_ERROR.toString(), null); break; case MediaPlayer.Event.TimeChanged: eventMap.putDouble(EVENT_PROP_CURRENT_TIME, mMediaPlayer.getTime()); eventMap.putDouble(EVENT_PROP_DURATION, mMediaPlayer.getLength()); eventMap.putDouble(EVENT_PROP_POSITION, mMediaPlayer.getPosition()); mEventEmitter.receiveEvent(getId(), Events.EVENT_PROGRESS.toString(), eventMap); break; } }
Example 5
Source File: UniversalPlayer.java From uPods-android with Apache License 2.0 | 4 votes |
@Override public void onEvent(MediaPlayer.Event event) { if (!isPrepaired && mediaItem instanceof Podcast) {//Try to continue for last position int lastPosition = ProfileManager.getInstance().getTrackPosition(((Podcast) mediaItem).getSelectedTrack()); if (lastPosition > 0) { seekTo(lastPosition); } } if (event.type == MediaPlayer.Event.Playing) { isPrepaired = true; if (playerStateListener != null) { playerStateListener.onStateChanged(State.PLAYING); //To make sure notification panel is in correct state if (notificationPanel != null && notificationPanel.getCurrentState() != State.PLAYING) { notificationPanel.updateNotificationStatus(State.PLAYING); } } } else if (event.type == MediaPlayer.Event.Paused) { isPrepaired = true; if (playerStateListener != null) { playerStateListener.onStateChanged(State.PAUSED); //To make sure notification panel is in correct state if (notificationPanel != null && notificationPanel.getCurrentState() != State.PAUSED) { notificationPanel.updateNotificationStatus(State.PAUSED); } } } else if (event.type == MediaPlayer.Event.EndReached) { if (mediaPlayer.getLength() == 0) { threwError(); if (playerStateListener != null) { playerStateListener.onStateChanged(State.END_REACHED); } } /*else { changeTrackToDirection(Direction.RIGHT); }*/ } else if (event.type == MediaPlayer.Event.EncounteredError) { if (!GlobalUtils.isInternetConnected()) { runReconnectTask(); } } //Logger.printInfo(PLAYER_LOG, "VLC event" + String.valueOf(event.type)); }
Example 6
Source File: VideoPlayerActivity.java From VCL-Android with Apache License 2.0 | 4 votes |
@Override public void onMediaPlayerEvent(MediaPlayer.Event event) { switch (event.type) { case MediaPlayer.Event.Opening: mHasSubItems = false; break; case MediaPlayer.Event.Playing: onPlaying(); break; case MediaPlayer.Event.Paused: updateOverlayPausePlay(); break; case MediaPlayer.Event.Stopped: exitOK(); break; case MediaPlayer.Event.EndReached: /* Don't end the activity if the media has subitems since the next child will be * loaded by the PlaybackService */ if (!mHasSubItems) endReached(); break; case MediaPlayer.Event.EncounteredError: encounteredError(); break; case MediaPlayer.Event.TimeChanged: break; case MediaPlayer.Event.Vout: updateNavStatus(); if (mMenuIdx == -1) handleVout(event.getVoutCount()); break; case MediaPlayer.Event.ESAdded: case MediaPlayer.Event.ESDeleted: if (mMenuIdx == -1 && event.getEsChangedType() == Media.Track.Type.Video) { mHandler.removeMessages(CHECK_VIDEO_TRACKS); mHandler.sendEmptyMessageDelayed(CHECK_VIDEO_TRACKS, 1000); } invalidateESTracks(event.getEsChangedType()); break; case MediaPlayer.Event.SeekableChanged: updateSeekable(event.getSeekable()); break; case MediaPlayer.Event.PausableChanged: updatePausable(event.getPausable()); break; } }
Example 7
Source File: MainActivity.java From vlc-example-streamplayer with GNU General Public License v3.0 | 2 votes |
@Override public void onBuffering(MediaPlayer.Event event) { }
Example 8
Source File: AudioPlayerActivity.java From VCL-Android with Apache License 2.0 | 2 votes |
@Override public void onMediaPlayerEvent(MediaPlayer.Event event) { }
Example 9
Source File: VlcListener.java From vlc-example-streamplayer with GNU General Public License v3.0 | votes |
void onBuffering(MediaPlayer.Event event);
Example 10
Source File: PlaybackService.java From VCL-Android with Apache License 2.0 | votes |
void onMediaPlayerEvent(MediaPlayer.Event event);