FloatingView
を実装したいと思います。アクティビティのサイズを変更してドラッグできるようにする(Pictureのように)私もこのthreadを参照し、それに基づいて自分自身のservice
を作成します。 (this & thisライブラリビデオストリーミングのための浮動表示の実装
問題は実装上、私はビデオを続行できず、時には画面も黒く表示されません。私はこれを処理する正しい方法が何かを知りたいですか?ビデオが中断されずに再生が継続されます。 (私は理由setOnPrepareListener
の中断を知っているが、それを避ける方法?)ここで
public class FloatingStream extends Service implements FloatingViewListener {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (mFloatingViewManager != null) {
return START_STICKY;
}
final DisplayMetrics metrics = new DisplayMetrics();
final WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
windowManager.getDefaultDisplay().getMetrics(metrics);
floatingServiceBinder = new FloatingServiceBinder(this);
final View rootView = LayoutInflater.from(this).inflate(R.layout.view_exoplayer, null, false);
final VideoView videoView = (VideoView) rootView.findViewById(R.id.video_view);
videoView.setVideoURI(Uri.parse(MY_URL));
videoView.setOnPreparedListener(new OnPreparedListener() {
@Override
public void onPrepared() {
videoView.start();
}
});
mFloatingViewManager = new FloatingViewManager(this, this);
mFloatingViewManager.setFixedTrashIconImage(R.drawable.ic_play_circle_filled);
mFloatingViewManager.setActionTrashIconImage(R.drawable.ic_menu);
final FloatingViewManager.Options options = new FloatingViewManager.Options();
mFloatingViewManager.addViewToWindow(rootView, options);
return START_REDELIVER_INTENT;
}
}
編集:それがあるため、ユーザーが別のものに行く場合は、このアプリではありませんdraggable panelですアクティビティビデオは中断されずに再生されます。
こんにちは、このダミーの質問は申し訳ありませんが、あなたは「ビデオを続けることはできません」とはどういう意味ですか?あなたはビデオを「スムーズに」見ることができないのですか? – jos
@jos GIFで見るように、画像は停止(または中断)されていません。サイズ変更アクティビティが** setOnPreparedListener **を呼び出す必要がないとき。 – Amir