Frequently Asked Question
How to open an embedded video?
Last Updated a year ago
To open an embedded video, you need to implement the listener PDFLayoutListener and in the method OnPDFOpenMovie, you can either open the system intent or a custom one...
To open a video using the system intent:
public void OnPDFOpenMovie(String path) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(path)); startActivity(intent); }
To open a video using a custom intent:
public void OnPDFOpenMovie(String path) { Intent intent = new Intent(this, VideoPlayer.class); intent.putExtra("VIDEOPATH", mVideoPath); startActivity(intent); } VideoPlayer:
public class VideoPlayer extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_video_player);
VideoView video_player_view = (VideoView) findViewById(R.id.video_player_view); video_player_view .setMediaController(new MediaController(this)); video_player_view .setVideoPath(getIntent().getStringExtra("VIDEOPATH")); video_player_view .start(); } } activity_video_player.xml: