Thursday, February 20, 2014
android newbie call the system default video player when the video finished not put how close the player
Btn in the Activity, click on btn call the system default player for local video playback
public Intent getVideoFileIntent (File videoFile)
{
Intent intent = new Intent (Intent.ACTION_VIEW);
intent.addFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra ("oneshot", 0);
intent.putExtra ("configchange", 0);
Uri uri = Uri.fromFile (videoFile);
intent.setDataAndType (uri, "video / *");
return intent;
}
In the OnCreate function:
btnplay = (Button) findViewById (R.id.button_play2);
btnplay.setOnClickListener (new OnClickListener ()
{
public void onClick (View v)
{
File file1 = new File ("/ sdcard/test.mp4");
Intent intent = getVideoFileIntent (file1);
startActivity (intent);
}
});
This approach also find online. Click btn program can call the system default player for playback of video files, video files when finished playing player can automatically shut down and displays the current Activity. If you do not put in the video finished, I pressed the phone to return the keys, the program returns to the current Activity, but do not turn off the video player and the sound has been placed. In this case, how to operate the player close?
I was made to open android newbie, we hope you master a lot of help!<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Their top! ! !
Reply:
That is the system comes with video player, is already forming apk, jump, better said, you want to operate third-party applications, which is somewhat difficult
You can use to write their own video player!
Reply:
You are using the real machine to try it, I suspect the problem is the system, the video playback point back stop should be your own
Reply:
I was using my own cell phone to try.
Reply:
Landlord, I recently encountered your problem is to call the system when the video player is not finished playing want to quit, do not know the landlord of your question is how to solve? Can pointers about it?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment