use of com.pili.pldroid.player.AVOptions in project PLDroidPlayer by pili-engineering.
the class PLMediaPlayerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_media_player);
mLoadingView = findViewById(R.id.LoadingView);
mSurfaceView = (SurfaceView) findViewById(R.id.SurfaceView);
mSurfaceView.getHolder().addCallback(mCallback);
mVideoPath = getIntent().getStringExtra("videoPath");
mAVOptions = new AVOptions();
int isLiveStreaming = getIntent().getIntExtra("liveStreaming", 1);
// the unit of timeout is ms
mAVOptions.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, 10 * 1000);
mAVOptions.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000);
mAVOptions.setInteger(AVOptions.KEY_PROBESIZE, 128 * 1024);
// Some optimization with buffering mechanism when be set to 1
mAVOptions.setInteger(AVOptions.KEY_LIVE_STREAMING, isLiveStreaming);
mIsLiveStreaming = isLiveStreaming == 1;
if (mIsLiveStreaming) {
mAVOptions.setInteger(AVOptions.KEY_DELAY_OPTIMIZATION, 1);
}
// 1 -> hw codec enable, 0 -> disable [recommended]
int iCodec = getIntent().getIntExtra("mediaCodec", AVOptions.MEDIA_CODEC_SW_DECODE);
mAVOptions.setInteger(AVOptions.KEY_MEDIACODEC, iCodec);
// whether start play automatically after prepared, default value is 1
mAVOptions.setInteger(AVOptions.KEY_START_ON_PREPARED, 0);
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audioManager.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
}
use of com.pili.pldroid.player.AVOptions in project PLDroidPlayer by pili-engineering.
the class PLAudioPlayerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_audio_player);
mLoadingView = findViewById(R.id.LoadingView);
mAudioPath = getIntent().getStringExtra("videoPath");
mAVOptions = new AVOptions();
int isLiveStreaming = getIntent().getIntExtra("liveStreaming", 1);
// the unit of timeout is ms
mAVOptions.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, 10 * 1000);
mAVOptions.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000);
mAVOptions.setInteger(AVOptions.KEY_PROBESIZE, 128 * 1024);
// Some optimization with buffering mechanism when be set to 1
mAVOptions.setInteger(AVOptions.KEY_LIVE_STREAMING, isLiveStreaming);
if (isLiveStreaming == 1) {
mAVOptions.setInteger(AVOptions.KEY_DELAY_OPTIMIZATION, 1);
}
// 1 -> hw codec enable, 0 -> disable [recommended]
int codec = getIntent().getIntExtra("mediaCodec", 0);
mAVOptions.setInteger(AVOptions.KEY_MEDIACODEC, codec);
// whether start play automatically after prepared, default value is 1
mAVOptions.setInteger(AVOptions.KEY_START_ON_PREPARED, 0);
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audioManager.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
prepare();
startTelephonyListener();
}
use of com.pili.pldroid.player.AVOptions in project PLDroidPlayer by pili-engineering.
the class PLVideoTextureActivity method setOptions.
private void setOptions(int codecType) {
AVOptions options = new AVOptions();
// the unit of timeout is ms
options.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, 10 * 1000);
options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000);
options.setInteger(AVOptions.KEY_PROBESIZE, 128 * 1024);
// Some optimization with buffering mechanism when be set to 1
options.setInteger(AVOptions.KEY_LIVE_STREAMING, mIsLiveStreaming);
if (mIsLiveStreaming == 1) {
options.setInteger(AVOptions.KEY_DELAY_OPTIMIZATION, 1);
}
// 1 -> hw codec enable, 0 -> disable [recommended]
options.setInteger(AVOptions.KEY_MEDIACODEC, codecType);
// whether start play automatically after prepared, default value is 1
options.setInteger(AVOptions.KEY_START_ON_PREPARED, 0);
mVideoView.setAVOptions(options);
}
use of com.pili.pldroid.player.AVOptions in project PLDroidPlayer by pili-engineering.
the class PLVideoViewActivity method setOptions.
private void setOptions(int codecType) {
AVOptions options = new AVOptions();
// the unit of timeout is ms
options.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, 10 * 1000);
options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000);
options.setInteger(AVOptions.KEY_PROBESIZE, 128 * 1024);
// Some optimization with buffering mechanism when be set to 1
options.setInteger(AVOptions.KEY_LIVE_STREAMING, mIsLiveStreaming);
if (mIsLiveStreaming == 1) {
options.setInteger(AVOptions.KEY_DELAY_OPTIMIZATION, 1);
}
// 1 -> hw codec enable, 0 -> disable [recommended]
options.setInteger(AVOptions.KEY_MEDIACODEC, codecType);
// whether start play automatically after prepared, default value is 1
options.setInteger(AVOptions.KEY_START_ON_PREPARED, 0);
mVideoView.setAVOptions(options);
}
Aggregations