use of org.videolan.libvlc.IVLCVout in project vlc-android by videolan.
the class VideoPlayerActivity method stopPlayback.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void stopPlayback() {
if (!mPlaybackStarted)
return;
if (mDisplayManager.isOnRenderer() && !isFinishing()) {
mPlaybackStarted = false;
return;
}
mWasPaused = !mService.isPlaying();
if (!isFinishing()) {
mCurrentAudioTrack = mService.getAudioTrack();
mCurrentSpuTrack = mService.getSpuTrack();
}
if (mMute)
mute(false);
mPlaybackStarted = false;
mService.setVideoTrackEnabled(false);
mService.removeCallback(this);
mHandler.removeCallbacksAndMessages(null);
final IVLCVout vlcVout = mService.getVLCVout();
vlcVout.removeCallback(this);
vlcVout.detachViews();
if (mService.hasMedia() && mSwitchingView) {
if (BuildConfig.DEBUG)
Log.d(TAG, "mLocation = \"" + mUri + "\"");
if (mSwitchToPopup)
mService.switchToPopup(mService.getCurrentMediaPosition());
else {
mService.getCurrentMediaWrapper().addFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
mService.showWithoutParse(mService.getCurrentMediaPosition());
}
return;
}
if (mService.isSeekable()) {
mSavedTime = getTime();
long length = mService.getLength();
// remove saved position if in the last 5 seconds
if (length - mSavedTime < 5000)
mSavedTime = 0;
else
// go back 2 seconds, to compensate loading time
mSavedTime -= 2000;
}
mSavedRate = mService.getRate();
mRateHasChanged = mSavedRate != 1.0f;
mService.setRate(1.0f, false);
mService.stop();
}
use of org.videolan.libvlc.IVLCVout in project vlc-android by videolan.
the class VideoPlayerActivity method startPlayback.
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void startPlayback() {
/* start playback only when audio service and both surfaces are ready */
if (mPlaybackStarted || mService == null)
return;
mSavedRate = 1.0f;
mSavedTime = -1;
mPlaybackStarted = true;
IVLCVout vlcVout = mService.getVLCVout();
if (vlcVout.areViewsAttached()) {
if (mService.isPlayingPopup()) {
mService.stop();
vlcVout = mService.getVLCVout();
} else
vlcVout.detachViews();
}
final DisplayManager.SecondaryDisplay sd = mDisplayManager.getPresentation();
vlcVout.setVideoView(sd != null ? sd.getSurfaceView() : mSurfaceView);
vlcVout.setSubtitlesView(sd != null ? sd.getSubtitlesSurfaceView() : mSubtitlesSurfaceView);
vlcVout.addCallback(this);
vlcVout.attachViews(this);
mService.setVideoTrackEnabled(true);
initUI();
loadMedia();
}
use of org.videolan.libvlc.IVLCVout in project vlc-android by videolan.
the class PopupManager method showPopup.
public void showPopup() {
mService.addCallback(this);
LayoutInflater li = (LayoutInflater) VLCApplication.getAppContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mRootView = (PopupLayout) li.inflate(R.layout.video_popup, null);
if (mAlwaysOn)
mRootView.setKeepScreenOn(true);
mPlayPauseButton = mRootView.findViewById(R.id.video_play_pause);
mCloseButton = mRootView.findViewById(R.id.popup_close);
mExpandButton = mRootView.findViewById(R.id.popup_expand);
mPlayPauseButton.setOnClickListener(this);
mCloseButton.setOnClickListener(this);
mExpandButton.setOnClickListener(this);
GestureDetectorCompat gestureDetector = new GestureDetectorCompat(mService, this);
gestureDetector.setOnDoubleTapListener(this);
mRootView.setGestureDetector(gestureDetector);
final IVLCVout vlcVout = mService.getVLCVout();
vlcVout.setVideoView((SurfaceView) mRootView.findViewById(R.id.player_surface));
vlcVout.addCallback(this);
vlcVout.attachViews(this);
mRootView.setVLCVOut(vlcVout);
}
use of org.videolan.libvlc.IVLCVout in project vlc-android by videolan.
the class PopupManager method removePopup.
public void removePopup() {
hideNotification();
if (mRootView == null)
return;
mService.removeCallback(this);
final IVLCVout vlcVout = mService.getVLCVout();
vlcVout.detachViews();
mRootView.close();
mRootView = null;
}
use of org.videolan.libvlc.IVLCVout in project butter-android by butterproject.
the class VlcPlayer method detachFromSurface.
public void detachFromSurface() {
final IVLCVout vlcVout = mediaPlayer.getVLCVout();
vlcVout.removeCallback(this);
vlcVout.detachViews();
}
Aggregations