Skip to content
Snippets Groups Projects
Commit 0b227fbc authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Popup: init video surface once it's ready

parent ac8b2513
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,7 @@ import org.videolan.vlc.gui.preferences.PreferencesActivity;
import org.videolan.vlc.gui.view.PopupLayout;
public class PopupManager implements PlaybackService.Callback, GestureDetector.OnDoubleTapListener,
View.OnClickListener, GestureDetector.OnGestureListener, IVLCVout.OnNewVideoLayoutListener {
View.OnClickListener, GestureDetector.OnGestureListener, IVLCVout.OnNewVideoLayoutListener, IVLCVout.Callback {
private static final String TAG ="VLC/PopupManager";
......@@ -96,9 +96,9 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
mRootView = (PopupLayout) li.inflate(R.layout.video_popup, null);
if (mAlwaysOn)
mRootView.setKeepScreenOn(true);
mPlayPauseButton = (ImageView) mRootView.findViewById(R.id.video_play_pause);
mCloseButton = (ImageView) mRootView.findViewById(R.id.popup_close);
mExpandButton = (ImageView) mRootView.findViewById(R.id.popup_expand);
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);
......@@ -109,17 +109,9 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
final IVLCVout vlcVout = mService.getVLCVout();
vlcVout.setVideoView((SurfaceView) mRootView.findViewById(R.id.player_surface));
vlcVout.addCallback(this);
vlcVout.attachViews(this);
mRootView.setVLCVOut(vlcVout);
mService.setVideoAspectRatio(null);
mService.setVideoScale(0);
mService.setVideoTrackEnabled(true);
if (!mService.isPlaying())
mService.playIndex(mService.getCurrentMediaPosition());
else
mService.flush();
mService.startService(new Intent(mService, PlaybackService.class));
showNotification();
}
@Override
......@@ -333,4 +325,21 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
private void hideNotification() {
NotificationManagerCompat.from(mService).cancel(42);
}
@Override
public void onSurfacesCreated(IVLCVout vlcVout) {
mService.setVideoAspectRatio(null);
mService.setVideoScale(0);
mService.setVideoTrackEnabled(true);
if (!mService.isPlaying())
mService.playIndex(mService.getCurrentMediaPosition());
else
mService.flush();
showNotification();
}
@Override
public void onSurfacesDestroyed(IVLCVout vlcVout) {
vlcVout.removeCallback(this);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment