Search in sources :

Example 1 with AVOptions

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);
}
Also used : AudioManager(android.media.AudioManager) AVOptions(com.pili.pldroid.player.AVOptions)

Example 2 with AVOptions

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();
}
Also used : AudioManager(android.media.AudioManager) AVOptions(com.pili.pldroid.player.AVOptions)

Example 3 with AVOptions

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);
}
Also used : AVOptions(com.pili.pldroid.player.AVOptions)

Example 4 with AVOptions

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);
}
Also used : AVOptions(com.pili.pldroid.player.AVOptions)

Aggregations

AVOptions (com.pili.pldroid.player.AVOptions)4 AudioManager (android.media.AudioManager)2