アクティビティから離れることなく現在のビューでビデオを再生できるかどうかを知りたいと思います。 AlertDialogのように、ぼかし効果があります。現在のAndroidビューでビデオを再生する
これは可能性がありますか、あなたはライブラリを知っていますか?
私はそれについて何も見つかりませんでした。
事前に感謝します。
アクティビティから離れることなく現在のビューでビデオを再生できるかどうかを知りたいと思います。 AlertDialogのように、ぼかし効果があります。現在のAndroidビューでビデオを再生する
これは可能性がありますか、あなたはライブラリを知っていますか?
私はそれについて何も見つかりませんでした。
事前に感謝します。
私はついにそれを簡単なDialogで解決しました。
は、JavaクラスのJava側では、あなたのレイアウト
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.sherazkhilji.videffects.view.VideoSurfaceView
android:id="@+id/mVideoSurfaceView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#a0000000">
//your layout goes here
</LinearLayout>
</RelativeLayout>
3では
compile 'com.sherazkhilji.videffects:videffects:1.0.2'
build.gradleアプリあなたに次のライブラリを追加します。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
playVdo();
}
@Override
protected void onResume() {
super.onResume();
mVideoView.onResume();
}
@Override
protected void onPause() {
super.onPause();
mVideoView.onPause();
}
private MediaPlayer mMediaPlayer;
private Resources mResources;
private VideoSurfaceView mVideoView;
private void playVdo() {
mResources = getResources();
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setScreenOnWhilePlaying(true);
mMediaPlayer.setVolume(0, 0);
try {
AssetFileDescriptor afd = getAssets().openFd("login_vdo.mp4");
mMediaPlayer.setDataSource(afd.getFileDescriptor(),
afd.getStartOffset(), afd.getLength());
} catch (Exception e) {
Log.e("mMediaPlayer", e.getMessage(), e);
}
mVideoView = (VideoSurfaceView) findViewById(R.id.mVideoSurfaceView);
mVideoView.init(mMediaPlayer,
new DocumentaryEffect());
}