-
Notifications
You must be signed in to change notification settings - Fork 0
Cookbook
jcVideoPlayer.startButton.performClick();
Touches to play in
NORMAL
state will pause the video during playback.
JZVideoPlayerStandard.startFullscreen(this,
JZVideoPlayerStandard.class,
"http://2449.vod.myqcloud.com/2449_22ca37a6ea9011e5acaaf51d105342e3.f20.mp4",
"Video title");
JZVideoPlayer.JZAutoFullscreenListener sensorEventListener;
SensorManager sensorManager;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
sensorEventListener = new JZVideoPlayer.JZAutoFullscreenListener();
}
@Override
protected void onResume() {
super.onResume();
Sensor accelerometerSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
sensorManager.registerListener(sensorEventListener, accelerometerSensor, SensorManager.SENSOR_DELAY_NORMAL);
}
@Override
protected void onPause() {
super.onPause();
sensorManager.unregisterListener(sensorEventListener);
}
Take a look at CustomMediaPlayerAssetsFolder class in demo project.
Pro-test if you pass the parameter
IMediaDataSource
directly, the video will freeze on the first frame and the background will report this error: Please copy to the local path to play.
After settingUp, set the seekToInAdvance
variable to set the progress. After the user clicks, it will automatically jump to this progress.
JZVideoPlayer.SAVE_PROGRESS = true
This class shows an example of how to capture user events while interacting with the player. Try not to write playback logic here, only events should be logged.
JZVideoPlayer.ACTION_BAR_EXIST
and JZVideoPlayer.TOOL_BAR_EXIST
can be manually controlled by these two variables to hide ToolBar and ActionBar.
jzVideoPlayer.widthRatio = 16;
jzVideoPlayer.heightRatio = 9;