Java Code Examples for tv.danmaku.ijk.media.player.IjkMediaPlayer#setOnPreparedListener()
The following examples show how to use
tv.danmaku.ijk.media.player.IjkMediaPlayer#setOnPreparedListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IjkPlayer.java From youqu_master with Apache License 2.0 | 6 votes |
@Override public void initPlayer() { mMediaPlayer = new IjkMediaPlayer(); setOptions(); mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mMediaPlayer.setOnErrorListener(onErrorListener); mMediaPlayer.setOnCompletionListener(onCompletionListener); mMediaPlayer.setOnInfoListener(onInfoListener); mMediaPlayer.setOnBufferingUpdateListener(onBufferingUpdateListener); mMediaPlayer.setOnPreparedListener(onPreparedListener); mMediaPlayer.setOnVideoSizeChangedListener(onVideoSizeChangedListener); mMediaPlayer.setOnNativeInvokeListener(new IjkMediaPlayer.OnNativeInvokeListener() { @Override public boolean onNativeInvoke(int i, Bundle bundle) { return true; } }); }
Example 2
Source File: IjkPlayer.java From DKVideoPlayer with Apache License 2.0 | 6 votes |
@Override public void initPlayer() { mMediaPlayer = new IjkMediaPlayer(); //native日志 IjkMediaPlayer.native_setLogLevel(VideoViewManager.getConfig().mIsEnableLog ? IjkMediaPlayer.IJK_LOG_INFO : IjkMediaPlayer.IJK_LOG_SILENT); setOptions(); mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mMediaPlayer.setOnErrorListener(onErrorListener); mMediaPlayer.setOnCompletionListener(onCompletionListener); mMediaPlayer.setOnInfoListener(onInfoListener); mMediaPlayer.setOnBufferingUpdateListener(onBufferingUpdateListener); mMediaPlayer.setOnPreparedListener(onPreparedListener); mMediaPlayer.setOnVideoSizeChangedListener(onVideoSizeChangedListener); mMediaPlayer.setOnNativeInvokeListener(new IjkMediaPlayer.OnNativeInvokeListener() { @Override public boolean onNativeInvoke(int i, Bundle bundle) { return true; } }); }
Example 3
Source File: PlayActivity.java From Interessant with Apache License 2.0 | 6 votes |
private void playVideo(String path) { try { mediaPlayer = new IjkMediaPlayer(); videoController.attachPlayer(mediaPlayer, item); boolean cacheWithWifi = PreferenceManager.getBooleanValue(this, SettingsFragment.CACHE_KEY, true); if (cacheWithWifi && NetUtils.isWifiConnected(this)) { String proxyPath = cacheServer().getProxyUrl(path); cacheServer().registerCacheListener(this, path); mediaPlayer.setDataSource(proxyPath); } else { mediaPlayer.setDataSource(path); } mediaPlayer.prepareAsync(); mediaPlayer.setOnBufferingUpdateListener(this); mediaPlayer.setOnCompletionListener(this); mediaPlayer.setOnPreparedListener(this); mediaPlayer.setOnInfoListener(this); mediaPlayer.setOnVideoSizeChangedListener(this); setVolumeControlStream(AudioManager.STREAM_MUSIC); mediaPlayer.setScreenOnWhilePlaying(true); videoController.startVideoPlayback(surfaceHolder); } catch (IOException e) { e.printStackTrace(); } }
Example 4
Source File: XMediaPlayer.java From XPlayer2 with Apache License 2.0 | 5 votes |
private IjkMediaPlayer createPlayer() { IjkMediaPlayer ijkMediaPlayer = new IjkMediaPlayer(); ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", 0); // 软解码 ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "opensles", 0); ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "overlay-format", IjkMediaPlayer.SDL_FCC_RV32); // 音视频不同步问题:framedrop 控制着允许丢帧的范围。可以通过修改 framedrop 的数值来解决不同步的问题, // framedrop是在视频帧处理不过来的时候丢弃一些帧达到同步的效果。 ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "framedrop", 1); // 准备完成后,自动开始播放 ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "start-on-prepared", 1); // IJKMEDIA: Option ijkiomanager not found. // IJKMEDIA: Option http-detect-range-support not found. // ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "http-detect-range-support", 0); // ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC, "skip_loop_filter", 48); ijkMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); ijkMediaPlayer.setScreenOnWhilePlaying(true); ijkMediaPlayer.setOnNativeInvokeListener(new IjkMediaPlayer.OnNativeInvokeListener() { @Override public boolean onNativeInvoke(int i, Bundle bundle) { return true; } }); ijkMediaPlayer.setOnPreparedListener(this); ijkMediaPlayer.setOnVideoSizeChangedListener(this); ijkMediaPlayer.setOnInfoListener(this); ijkMediaPlayer.setOnBufferingUpdateListener(this); ijkMediaPlayer.setOnSeekCompleteListener(this); ijkMediaPlayer.setOnCompletionListener(this); ijkMediaPlayer.setOnErrorListener(this); // 开启调试的LOG IjkMediaPlayer.native_setLogLevel(IjkMediaPlayer.IJK_LOG_DEBUG); return ijkMediaPlayer; }
Example 5
Source File: IjkWrapper.java From Fatigue-Detection with MIT License | 5 votes |
public void init(){ mStatus = STATUS_IDLE; mPlayer = new IjkMediaPlayer(); mPlayer.setOnPreparedListener(this); mPlayer.setOnInfoListener(new IMediaPlayer.OnInfoListener() { @Override public boolean onInfo(IMediaPlayer mp, int what, int extra) { return false; } }); }
Example 6
Source File: MediaPlayerWrapper.java From MD360Player4Android with Apache License 2.0 | 5 votes |
public void init(){ mStatus = STATUS_IDLE; mPlayer = new IjkMediaPlayer(); mPlayer.setOnPreparedListener(this); mPlayer.setOnInfoListener(new IMediaPlayer.OnInfoListener() { @Override public boolean onInfo(IMediaPlayer mp, int what, int extra) { return false; } }); enableHardwareDecoding(); }