当前位置: 首页>>代码示例>>Java>>正文


Java AVOptions类代码示例

本文整理汇总了Java中com.pili.pldroid.player.AVOptions的典型用法代码示例。如果您正苦于以下问题:Java AVOptions类的具体用法?Java AVOptions怎么用?Java AVOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AVOptions类属于com.pili.pldroid.player包,在下文中一共展示了AVOptions类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LivePlayerHolder

import com.pili.pldroid.player.AVOptions; //导入依赖的package包/类
public LivePlayerHolder(BaseTvShowActivity mActivity, SurfaceView surfaceView, Integer codec, String mVideoPath) {
    this.mActivity = mActivity;
    this.codec = codec;
    this.mVideoPath = mVideoPath;
    this.mSurfaceView = surfaceView;
    //init
    mSurfaceView.getHolder().addCallback(mCallback);
    mAVOptions = new AVOptions();
    mAVOptions.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, 10 * 1000);
    mAVOptions.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000);
    mAVOptions.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
    mAVOptions.setInteger(AVOptions.KEY_DELAY_OPTIMIZATION, 1);
    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) App.getAppContext().getSystemService(Context.AUDIO_SERVICE);
    audioManager.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:LivePlayerHolder.java

示例2: setSource

import com.pili.pldroid.player.AVOptions; //导入依赖的package包/类
/**
 * 设置source属性,包括是否是直播流,解码类型,准备时长,是否有缓存等
 *
 * @param plVideoTextureView
 * @param source
 */
@ReactProp(name = "source")
public void setSource(PLVideoTextureView plVideoTextureView, ReadableMap source) {
    AVOptions avOptions = new AVOptions();
     uri = source.getString("uri");//视频连接地址
    //得到解码类型
    int mediaCodec = source.hasKey("mediaCodec") ? source.getInt("mediaCodec") : AVOptions.MEDIA_CODEC_SW_DECODE;
    //得到视频准备时间
    int timeout = source.hasKey("timeout") ? source.getInt("timeout") : 10 * 1000;
    //得到是否是直播流
    boolean liveStreaming = source.hasKey("liveStreaming") ? source.getBoolean("liveStreaming") : false;
    //得到是否应用缓存
    boolean cache = source.hasKey("cache") ? source.getBoolean("cache") : false;
    boolean started=source.hasKey("started")?source.getBoolean("started"):true;
    avOptions.setInteger(AVOptions.KEY_MEDIACODEC, mediaCodec);
    avOptions.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, timeout);
    avOptions.setInteger(AVOptions.KEY_LIVE_STREAMING, liveStreaming ? 1 : 0);
    if (!liveStreaming && cache) {
        avOptions.setString(AVOptions.KEY_CACHE_DIR, Config.DEFAULT_CACHE_DIR);
    }
    plVideoTextureView.setAVOptions(avOptions);
    //MediaController mediaController = new MediaController(themedReactContext, !liveStreaming, liveStreaming);
   // plVideoTextureView.setMediaController(mediaController);
    plVideoTextureView.setVideoPath(uri);
}
 
开发者ID:2534290808,项目名称:react-native-android-piliplayer,代码行数:31,代码来源:PLVideoTextureViewManager.java

示例3: LivePlayerHolder

import com.pili.pldroid.player.AVOptions; //导入依赖的package包/类
public LivePlayerHolder(BaseLiveUI mActivity, SurfaceView surfaceView, Integer codec, String mVideoPath){
    this.mActivity=mActivity;
    this.codec=codec;
    this.mVideoPath=mVideoPath;
    this.mSurfaceView=surfaceView;
    //init
    mSurfaceView.getHolder().addCallback(mCallback);
    mAVOptions = new AVOptions();
    mAVOptions.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, 10 * 1000);
    mAVOptions.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000);
    mAVOptions.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
    mAVOptions.setInteger(AVOptions.KEY_DELAY_OPTIMIZATION, 1);
    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) APP.getContext().getSystemService(Context.AUDIO_SERVICE);
    audioManager.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
}
 
开发者ID:a371166028,项目名称:likequanmintv,代码行数:20,代码来源:LivePlayerHolder.java

示例4: onCreate

import com.pili.pldroid.player.AVOptions; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_playback);

    PLUploadSetting uploadSetting = new PLUploadSetting();

    mVideoUploadManager = new PLShortVideoUploader(getApplicationContext(), uploadSetting);
    mVideoUploadManager.setUploadProgressListener(this);
    mVideoUploadManager.setUploadResultListener(this);

    mUploadBtn = (Button) findViewById(R.id.upload_btn);
    mUploadBtn.setText(R.string.upload);
    mUploadBtn.setOnClickListener(new UploadOnClickListener());
    mProgressBarDeterminate = (ProgressBar) findViewById(R.id.progressBar);
    mProgressBarDeterminate.setMax(100);
    mVideoView = (PLVideoTextureView) findViewById(R.id.video);
    mVideoPath = getIntent().getStringExtra(MP4_PATH);
    mVideoView.setLooping(true);
    mVideoView.setAVOptions(new AVOptions());
    mVideoView.setVideoPath(mVideoPath);
    MediaController mediaController = new MediaController(this, true, false);
    mediaController.setOnClickSpeedAdjustListener(mOnClickSpeedAdjustListener);
    mVideoView.setMediaController(mediaController);

    mVideoView.setOnInfoListener(mOnInfoListener);
    mVideoView.setOnVideoSizeChangedListener(mOnVideoSizeChangedListener);
    mVideoView.setOnBufferingUpdateListener(mOnBufferingUpdateListener);
    mVideoView.setOnCompletionListener(mOnCompletionListener);
    mVideoView.setOnErrorListener(mOnErrorListener);
    mVideoView.setOnVideoFrameListener(mOnVideoFrameListener);
    mVideoView.setOnAudioFrameListener(mOnAudioFrameListener);
}
 
开发者ID:pili-engineering,项目名称:PLDroidShortVideo,代码行数:37,代码来源:PlaybackActivity.java

示例5: setSource

import com.pili.pldroid.player.AVOptions; //导入依赖的package包/类
@ReactProp(name = "source")
    public void setSource(PLVideoView mVideoView, ReadableMap source) {
        AVOptions options = new AVOptions();
        String uri = source.getString("uri");
        boolean mediaController = source.hasKey("controller") && source.getBoolean("controller");
        int avFrameTimeout = source.hasKey("timeout") ? source.getInt("timeout") : -1;        //10 * 1000 ms
        //boolean liveStreaming = source.hasKey("live") && source.getBoolean("live");  //1 or 0 // 1 -> live
        boolean codec = source.hasKey("hardCodec") && source.getBoolean("hardCodec");  //1 or 0  // 1 -> hw codec enable, 0 -> disable [recommended]
        // the unit of timeout is ms
        if (avFrameTimeout >= 0) {
            options.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, avFrameTimeout);
        }
        // Some optimization with buffering mechanism when be set to 1
        options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
//        }

        // 1 -> hw codec enable, 0 -> disable [recommended]
        if (codec) {
            options.setInteger(AVOptions.KEY_MEDIACODEC, 1);
        } else {
            options.setInteger(AVOptions.KEY_MEDIACODEC, 0);
        }

        mVideoView.setAVOptions(options);

        // After setVideoPath, the play will start automatically
        // mVideoView.start() is not required

        mVideoView.setVideoPath(uri);

//        if (mediaController) {
//            // You can also use a custom `MediaController` widget
//            MediaController mMediaController = new MediaController(reactContext, false, isLiveStreaming(uri));
//            mVideoView.setMediaController(mMediaController);
//        }

    }
 
开发者ID:An-uking,项目名称:react-native-pili-player,代码行数:38,代码来源:PiliLiveViewManager.java

示例6: setSource

import com.pili.pldroid.player.AVOptions; //导入依赖的package包/类
@ReactProp(name = "source")
    public void setSource(PLVideoView mVideoView, ReadableMap source) {
        AVOptions options = new AVOptions();
        String uri = source.getString("uri");
        boolean mediaController = source.hasKey("controller") && source.getBoolean("controller");
        int avFrameTimeout = source.hasKey("timeout") ? source.getInt("timeout") : -1;        //10 * 1000 ms
        //boolean liveStreaming = source.hasKey("live") && source.getBoolean("live");  //1 or 0 // 1 -> live
        boolean codec = source.hasKey("hardCodec") && source.getBoolean("hardCodec");  //1 or 0  // 1 -> hw codec enable, 0 -> disable [recommended]
        // the unit of timeout is ms
        if (avFrameTimeout >= 0) {
            options.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, avFrameTimeout);
        }
        // Some optimization with buffering mechanism when be set to 1
        options.setInteger(AVOptions.KEY_LIVE_STREAMING, 0);
//        }

        // 1 -> hw codec enable, 0 -> disable [recommended]
        if (codec) {
            options.setInteger(AVOptions.KEY_MEDIACODEC, 1);
        } else {
            options.setInteger(AVOptions.KEY_MEDIACODEC, 0);
        }

        mVideoView.setAVOptions(options);

        // After setVideoPath, the play will start automatically
        // mVideoView.start() is not required

        mVideoView.setVideoPath(uri);

//        if (mediaController) {
//            // You can also use a custom `MediaController` widget
//            MediaController mMediaController = new MediaController(reactContext, false, isLiveStreaming(uri));
//            mVideoView.setMediaController(mMediaController);
//        }

    }
 
开发者ID:An-uking,项目名称:react-native-pili-player,代码行数:38,代码来源:PiliPlayerViewManager.java

示例7: onCreate

import com.pili.pldroid.player.AVOptions; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    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();

    if (isLiveStreaming(mVideoPath)) {
        // the unit of timeout is ms
        mAVOptions.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000);
        // Some optimization with buffering mechanism when be set to 1
        mAVOptions.setInteger(AVOptions.KEY_LIVE_STREAMING, 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);
}
 
开发者ID:qq137712630,项目名称:MeiZiNews,代码行数:31,代码来源:PLMediaPlayerActivity.java

示例8: setSource

import com.pili.pldroid.player.AVOptions; //导入依赖的package包/类
@ReactProp(name = "source")
    public void setSource(PLVideoView mVideoView, ReadableMap source) {
        AVOptions options = new AVOptions();
        String uri = source.getString("uri");
        boolean mediaController = source.hasKey("controller") && source.getBoolean("controller");
        int avFrameTimeout = source.hasKey("timeout") ? source.getInt("timeout") : -1;        //10 * 1000 ms
        boolean liveStreaming = source.hasKey("live") && source.getBoolean("live");  //1 or 0 // 1 -> live
        boolean codec = source.hasKey("hardCodec") && source.getBoolean("hardCodec");  //1 or 0  // 1 -> hw codec enable, 0 -> disable [recommended]
        // the unit of timeout is ms
        if (avFrameTimeout >= 0) {
            options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, avFrameTimeout);
        }
        // Some optimization with buffering mechanism when be set to 1
        if (liveStreaming) {
            options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
        } else {
            options.setInteger(AVOptions.KEY_LIVE_STREAMING, 0);
        }
//        }

        // 1 -> hw codec enable, 0 -> disable [recommended]
        if (codec) {
            options.setInteger(AVOptions.KEY_MEDIACODEC, 1);
        } else {
            options.setInteger(AVOptions.KEY_MEDIACODEC, 0);
        }

        mVideoView.setAVOptions(options);

        // After setVideoPath, the play will start automatically
        // mVideoView.start() is not required

        mVideoView.setVideoPath(uri);

//        if (mediaController) {
//            // You can also use a custom `MediaController` widget
//            MediaController mMediaController = new MediaController(reactContext, false, isLiveStreaming(uri));
//            mVideoView.setMediaController(mMediaController);
//        }

    }
 
开发者ID:pili-engineering,项目名称:pili-react-native,代码行数:42,代码来源:PiliPlayerViewManager.java

示例9: onCreate

import com.pili.pldroid.player.AVOptions; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    super.onCreate(savedInstanceState);
    setContentView(com.qiniu.pili.droid.rtcstreaming.demo.R.layout.activity_playback);
    mVideoView = (PLVideoView) findViewById(com.qiniu.pili.droid.rtcstreaming.demo.R.id.VideoView);

    mLoadingView = findViewById(com.qiniu.pili.droid.rtcstreaming.demo.R.id.LoadingView);
    mVideoView.setBufferingIndicator(mLoadingView);

    mVideoPath = getIntent().getStringExtra("videoPath");
    mRoomName  = getIntent().getStringExtra("roomName");
    mIsExtCapture = getIntent().getBooleanExtra("extCapture", false);
    mIsPKMode = getIntent().getBooleanExtra("pkmode", false);
    mIsLandscape = getIntent().getBooleanExtra("orientation", false);
    mIsAudioOnly = getIntent().getBooleanExtra("audioOnly", false);
    mIsSWCodec = getIntent().getBooleanExtra("swcodec", true);
    mIsFaceBeautyEnabled = getIntent().getBooleanExtra("beauty", true);
    setRequestedOrientation(mIsLandscape ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    AVOptions options = new AVOptions();
    options.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, 10 * 1000);
    options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000);
    options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
    options.setInteger(AVOptions.KEY_DELAY_OPTIMIZATION, 1);

    // 1 -> hw codec enable, 0 -> disable [recommended]
    options.setInteger(AVOptions.KEY_MEDIACODEC, 0);

    // whether start play automatically after prepared, default value is 1
    options.setInteger(AVOptions.KEY_START_ON_PREPARED, 0);

    mVideoView.setAVOptions(options);
    mVideoView.setDisplayAspectRatio(PLVideoView.ASPECT_RATIO_PAVED_PARENT);

    // Set some listeners
    mVideoView.setOnInfoListener(mOnInfoListener);
    mVideoView.setOnCompletionListener(mOnCompletionListener);
    mVideoView.setOnErrorListener(mOnErrorListener);

    mVideoView.setVideoPath(mVideoPath);
}
 
开发者ID:pili-engineering,项目名称:PLDroidRTCStreaming,代码行数:43,代码来源:PlaybackActivity.java

示例10: onCreate

import com.pili.pldroid.player.AVOptions; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        setContentView(R.layout.activity_pl_video_texture);
        mVideoView = (PLVideoTextureView) findViewById(R.id.VideoView);

        View loadingView = findViewById(R.id.LoadingView);
        mVideoView.setBufferingIndicator(loadingView);

        mVideoPath = getIntent().getStringExtra("videoPath");

        // If you want to fix display orientation such as landscape, you can use the code show as follow
        //
        // if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        //     mVideoView.setPreviewOrientation(0);
        // }
        // else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        //     mVideoView.setPreviewOrientation(270);
        // }

        mVideoPath = getIntent().getStringExtra("videoPath");

        AVOptions options = new AVOptions();

        if (isLiveStreaming(mVideoPath)) {
            // the unit of timeout is ms
            options.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000);
            // Some optimization with buffering mechanism when be set to 1
            options.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
        }

        // 1 -> hw codec enable, 0 -> disable [recommended]
        int codec = getIntent().getIntExtra("mediaCodec", 0);
        options.setInteger(AVOptions.KEY_MEDIACODEC, codec);

        // whether start play automatically after prepared, default value is 1
        options.setInteger(AVOptions.KEY_START_ON_PREPARED, 0);

        mVideoView.setAVOptions(options);

        // You can mirror the display
        // mVideoView.setMirror(true);

        // You can also use a custom `MediaController` widget
//        mMediaController = new MediaController(this, false, isLiveStreaming(mVideoPath));
        mMediaController = new MediaController(this, false, true);
        mVideoView.setMediaController(mMediaController);

        mVideoView.setOnCompletionListener(mOnCompletionListener);
        mVideoView.setOnErrorListener(mOnErrorListener);

        mVideoView.setVideoPath(mVideoPath);
        mVideoView.start();
    }
 
开发者ID:qq137712630,项目名称:MeiZiNews,代码行数:56,代码来源:PLVideoTextureActivity.java


注:本文中的com.pili.pldroid.player.AVOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。