• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PLMediaPlayer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onInfo

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public boolean onInfo(PLMediaPlayer mp, int what, int extra) {
    Log.i(TAG, "OnInfo, what = " + what + ", extra = " + extra);
    switch (what) {
        case PLMediaPlayer.MEDIA_INFO_BUFFERING_START:

            mActivity.onConnecting();
            break;
        case PLMediaPlayer.MEDIA_INFO_BUFFERING_END:
        case PLMediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START:
            mActivity.onConnectSucces();
            break;
        default:
            break;
    }
    return true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:LivePlayerHolder.java


示例2: onError

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public boolean onError(PLMediaPlayer mp, int errorCode) {
    Log.e(TAG, "Error happened, errorCode = " + errorCode);
    switch (errorCode) {
        case PLMediaPlayer.ERROR_CODE_IO_ERROR:
            /**
             * SDK will do reconnecting automatically
             */
            Log.e(TAG, "IO Error!");
            return false;
        case PLMediaPlayer.ERROR_CODE_OPEN_FAILED:
            ToastUtils.s(PlaybackActivity.this, "failed to open player !");
            break;
        case PLMediaPlayer.ERROR_CODE_SEEK_FAILED:
            ToastUtils.s(PlaybackActivity.this, "failed to seek !");
            break;
        default:
            ToastUtils.s(PlaybackActivity.this, "unknown error !");
            break;
    }
    finish();
    return true;
}
 
开发者ID:pili-engineering,项目名称:PLDroidShortVideo,代码行数:24,代码来源:PlaybackActivity.java


示例3: onInfo

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public boolean onInfo(PLMediaPlayer plMediaPlayer, int what, int extra) {
    //Log.d(TAG, "onInfo: " + what + ", " + extra);
    switch (what) {
        case PLMediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START:
            //一下两行解决flv开始黑屏的问题
            if(uri.indexOf(".flv")!=-1){
                plVideoTextureView.pause();
                plVideoTextureView.start();
            }
            mEventEmitter.receiveEvent(getTargetId(), Events.PLAYING.toString(), Arguments.createMap());
            break;
        case PLMediaPlayer.MEDIA_INFO_BUFFERING_START:
            mEventEmitter.receiveEvent(getTargetId(),Events.BUFFERING_START.toString(),Arguments.createMap());
            break;
        case PLMediaPlayer.MEDIA_INFO_BUFFERING_END:
            mEventEmitter.receiveEvent(getTargetId(), Events.BUFFERING_END.toString(), Arguments.createMap());
            break;
    }
    return true;
}
 
开发者ID:2534290808,项目名称:react-native-android-piliplayer,代码行数:22,代码来源:PLVideoTextureViewManager.java


示例4: onInfo

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public boolean onInfo(PLMediaPlayer mp, int what, int extra) {
    Log.i(TAG, "OnInfo, what = " + what + ", extra = " + extra);
    switch (what) {
        case PLMediaPlayer.MEDIA_INFO_BUFFERING_START:
            mLoadingView.setVisibility(View.VISIBLE);
            break;
        case PLMediaPlayer.MEDIA_INFO_BUFFERING_END:
        case PLMediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START:
            mLoadingView.setVisibility(View.GONE);
            break;
        default:
            break;
    }
    return true;
}
 
开发者ID:qq137712630,项目名称:MeiZiNews,代码行数:17,代码来源:PLMediaPlayerActivity.java


示例5: onVideoSizeChanged

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public void onVideoSizeChanged(PLMediaPlayer plMediaPlayer, int width, int height, int i2, int i3) {
    videoWidth = width;
    videoHeight = height;

    if (videoWidth != 0 && videoHeight != 0) {
        float ratioW = (float) videoWidth / (float) (isFullscreen ? ScreenUtils.getScreenWidth() : surfacePortraitWidth);
        float ratioH = (float) videoHeight / (float) (isFullscreen ? ScreenUtils.getScreenHeight() : surfacePortraitHeight);
        float ratio = Math.max(ratioW, ratioH);
        playWidth = (int) Math.ceil((float) videoWidth / ratio);
        playHeight = (int) Math.ceil((float) videoHeight / ratio);
        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(playWidth, playHeight);
        lp.gravity = Gravity.CENTER;
        surfaceView.setLayoutParams(lp);
    }
}
 
开发者ID:452MJ,项目名称:C9MJ,代码行数:17,代码来源:LivePlayActivity.java


示例6: onVideoSizeChanged

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
public void onVideoSizeChanged(PLMediaPlayer mp, int width, int height) {
            Log.i(TAG, "onVideoSizeChanged, width = " + width + ",height = " + height);
            // resize the display window to fit the screen
            if (width != 0 && height != 0) {
                float ratioW = (float) width / (float) mSurfaceWidth;
                float ratioH = (float) height / (float) mSurfaceHeight;
                float ratio = Math.max(ratioW, ratioH);
                width = (int) Math.ceil((float) width / ratio);
                height = (int) Math.ceil((float) height / ratio);
//                FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(width, height);
//                layout.gravity = Gravity.CENTER;
//                mSurfaceView.setLayoutParams(layout);
            }
        }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:LivePlayerHolder.java


示例7: onError

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public boolean onError(PLMediaPlayer plMediaPlayer, int errorCode) {
    //Log.e(TAG, "Error happened, errorCode = " + errorCode);
    WritableMap event = Arguments.createMap();
    event.putInt("errorCode",errorCode);
    mEventEmitter.receiveEvent(getTargetId(), Events.ERROR.toString(), Arguments.createMap());
    return true;
}
 
开发者ID:2534290808,项目名称:react-native-android-piliplayer,代码行数:9,代码来源:PLVideoTextureViewManager.java


示例8: onError

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public boolean onError(PLMediaPlayer mp, int errorCode) {
    switch (errorCode) {
        case PLMediaPlayer.ERROR_CODE_INVALID_URI:
            showToastTips("Invalid URL !");
            break;
        case PLMediaPlayer.ERROR_CODE_404_NOT_FOUND:
            showToastTips("404 resource not found !");
            break;
        case PLMediaPlayer.ERROR_CODE_CONNECTION_REFUSED:
            showToastTips("Connection refused !");
            break;
        case PLMediaPlayer.ERROR_CODE_CONNECTION_TIMEOUT:
            showToastTips("Connection timeout !");
            break;
        case PLMediaPlayer.ERROR_CODE_EMPTY_PLAYLIST:
            showToastTips("Empty playlist !");
            break;
        case PLMediaPlayer.ERROR_CODE_STREAM_DISCONNECTED:
            showToastTips("Stream disconnected !");
            break;
        case PLMediaPlayer.ERROR_CODE_IO_ERROR:
            showToastTips("Network IO Error !");
            break;
        case PLMediaPlayer.MEDIA_ERROR_UNKNOWN:
        default:
            showToastTips("unknown error !");
            break;
    }
    // Todo pls handle the error status here, retry or call finish()
    finish();
    // If you want to retry, do like this:
    // mVideoView.setVideoPath(mVideoPath);
    // mVideoView.start();
    // Return true means the error has been handled
    // If return false, then `onCompletion` will be called
    return true;
}
 
开发者ID:qq137712630,项目名称:MeiZiNews,代码行数:39,代码来源:PLVideoTextureActivity.java


示例9: onVideoSizeChanged

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
public void onVideoSizeChanged(PLMediaPlayer mp, int width, int height) {
    Log.i(TAG, "onVideoSizeChanged, width = "+ width + ",height = " + height);
    // resize the display window to fit the screen
    if (width != 0 && height != 0) {
        float ratioW = (float) width/(float) mSurfaceWidth;
        float ratioH = (float) height/(float) mSurfaceHeight;
        float ratio = Math.max(ratioW, ratioH);
        width  = (int) Math.ceil((float)width/ratio);
        height = (int) Math.ceil((float)height/ratio);
        FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(width, height);
        layout.gravity = Gravity.CENTER;
        mSurfaceView.setLayoutParams(layout);
    }
}
 
开发者ID:qq137712630,项目名称:MeiZiNews,代码行数:15,代码来源:PLMediaPlayerActivity.java


示例10: onVideoSizeChanged

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
public void onVideoSizeChanged(PLMediaPlayer mp, int width, int height) {
            Log.i(TAG, "onVideoSizeChanged, width = "+ width + ",height = " + height);
            // resize the display window to fit the screen
            if (width != 0 && height != 0) {
                float ratioW = (float) width/(float) mSurfaceWidth;
                float ratioH = (float) height/(float) mSurfaceHeight;
                float ratio = Math.max(ratioW, ratioH);
                width  = (int) Math.ceil((float)width/ratio);
                height = (int) Math.ceil((float)height/ratio);
//                FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(width, height);
//                layout.gravity = Gravity.CENTER;
//                mSurfaceView.setLayoutParams(layout);
            }
        }
 
开发者ID:a371166028,项目名称:likequanmintv,代码行数:15,代码来源:LivePlayerHolder.java


示例11: getErrorMessage

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
private static String getErrorMessage(int code) {
    String msg;
    switch (code) {
        case PLMediaPlayer.ERROR_CODE_INVALID_URI:
            msg = "Invalid URL !";
            break;
        case PLMediaPlayer.ERROR_CODE_404_NOT_FOUND:
            msg = "404 resource not found !";
            break;
        case PLMediaPlayer.ERROR_CODE_CONNECTION_REFUSED:
            msg = "Connection refused !";
            break;
        case PLMediaPlayer.ERROR_CODE_CONNECTION_TIMEOUT:
            msg = "Connection timeout !";
            break;
        case PLMediaPlayer.ERROR_CODE_EMPTY_PLAYLIST:
            msg = "Empty playlist !";
            break;
        case PLMediaPlayer.ERROR_CODE_STREAM_DISCONNECTED:
            msg = "Stream disconnected !";
            break;
        case PLMediaPlayer.ERROR_CODE_IO_ERROR:
            msg = "Network IO Error !";
            break;
        case PLMediaPlayer.ERROR_CODE_UNAUTHORIZED:
            msg = "Unauthorized Error !";
            break;
        case PLMediaPlayer.ERROR_CODE_PREPARE_TIMEOUT:
            msg = "Prepare timeout !";
            break;
        case PLMediaPlayer.ERROR_CODE_READ_FRAME_TIMEOUT:
            msg = "Read frame timeout !";
            break;
        case PLMediaPlayer.MEDIA_ERROR_UNKNOWN:
        default:
            msg = "unknown error !";
            break;
    }
    return msg;
}
 
开发者ID:452MJ,项目名称:C9MJ,代码行数:41,代码来源:MediaException.java


示例12: onInfo

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
    public boolean onInfo(PLMediaPlayer plMediaPlayer, int what, int extra) {
        switch (what) {
            case PLMediaPlayer.MEDIA_INFO_BUFFERING_START://开始缓冲
//                isVideoPrepared = false;
                Log.d("PLMediaPlayer", "onInfo: MEDIA_INFO_BUFFERING_START");
                break;
            case PLMediaPlayer.MEDIA_INFO_BUFFERING_END://缓冲结束
                Log.d("PLMediaPlayer", "onInfo: MEDIA_INFO_BUFFERING_END");
                break;
            case PLMediaPlayer.MEDIA_INFO_BUFFERING_BYTES_UPDATE:
                Log.d("PLMediaPlayer", "onInfo: MEDIA_INFO_BUFFERING_BYTES_UPDATE");
                break;
            case PLMediaPlayer.MEDIA_INFO_NOT_SEEKABLE:
                Log.d("PLMediaPlayer", "onInfo: MEDIA_INFO_NOT_SEEKABLE");
                break;
            case PLMediaPlayer.MEDIA_INFO_VIDEO_ROTATION_CHANGED:
                Log.d("PLMediaPlayer", "onInfo: MEDIA_INFO_VIDEO_ROTATION_CHANGED");
                break;
            case PLMediaPlayer.MEDIA_INFO_AUDIO_RENDERING_START:
                Log.d("PLMediaPlayer", "onInfo: MEDIA_INFO_AUDIO_RENDERING_START");
                break;
            case PLMediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START://视频缓冲完成可播放
                progressbar.setVisibility(View.GONE);
                isVideoPrepared = true;
                isPause = false;
                iv_play_pause_landscape.setImageResource(isPause ? R.drawable.selector_btn_play : R.drawable.selector_btn_pause);
                Log.d("PLMediaPlayer", "onInfo: MEDIA_INFO_VIDEO_RENDERING_START");
                break;
            default:
                Log.d("PLMediaPlayer", "onInfo: " + what);
                break;
        }
        return true;
    }
 
开发者ID:452MJ,项目名称:C9MJ,代码行数:36,代码来源:LivePlayActivity.java


示例13: onPrepared

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public void onPrepared(PLMediaPlayer mp) {
    Log.i(TAG, "On Prepared !");
    startPlayer();
    mIsStopped = false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:LivePlayerHolder.java


示例14: onBufferingUpdate

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
        public void onBufferingUpdate(PLMediaPlayer mp, int percent) {
//            Log.d(TAG, "onBufferingUpdate: " + percent + "%");
        }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:LivePlayerHolder.java


示例15: onCompletion

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public void onCompletion(PLMediaPlayer mp) {
    Log.d(TAG, "Play Completed !");
    showToastTips("Play Completed !");
    mActivity.finish(); //// TODO: 2016/11/27 播放完成
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:LivePlayerHolder.java


示例16: onError

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public boolean onError(PLMediaPlayer mp, int errorCode) {
    boolean isNeedReconnect = false;
    Log.e(TAG, "Error happened, errorCode = " + errorCode);
    switch (errorCode) {
        case PLMediaPlayer.ERROR_CODE_INVALID_URI:
            showToastTips("Invalid URL !");
            break;
        case PLMediaPlayer.ERROR_CODE_404_NOT_FOUND:
            showToastTips("404 resource not found !");
            break;
        case PLMediaPlayer.ERROR_CODE_CONNECTION_REFUSED:
            showToastTips("Connection refused !");
            break;
        case PLMediaPlayer.ERROR_CODE_CONNECTION_TIMEOUT:
            showToastTips("Connection timeout !");
            isNeedReconnect = true;
            break;
        case PLMediaPlayer.ERROR_CODE_EMPTY_PLAYLIST:
            showToastTips("Empty playlist !");
            break;
        case PLMediaPlayer.ERROR_CODE_STREAM_DISCONNECTED:
            showToastTips("Stream disconnected !");
            isNeedReconnect = true;
            break;
        case PLMediaPlayer.ERROR_CODE_IO_ERROR:
            showToastTips("Network IO Error !");
            isNeedReconnect = true;
            break;
        case PLMediaPlayer.ERROR_CODE_UNAUTHORIZED:
            showToastTips("Unauthorized Error !");
            break;
        case PLMediaPlayer.ERROR_CODE_PREPARE_TIMEOUT:
            showToastTips("Prepare timeout !");
            isNeedReconnect = true;
            break;
        case PLMediaPlayer.ERROR_CODE_READ_FRAME_TIMEOUT:
            showToastTips("Read frame timeout !");
            isNeedReconnect = true;
            break;
        case PLMediaPlayer.MEDIA_ERROR_UNKNOWN:
            break;
        default:
            showToastTips("unknown error !");
            break;
    }
    // Todo pls handle the error status here, reconnect or call finish()
    release();
    if (isNeedReconnect) {
        mActivity.onReConnecting();
        prepare();
    } else {
        mActivity.finish();
    }
    // Return true means the error has been handled
    // If return false, then `onCompletion` will be called
    return true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:59,代码来源:LivePlayerHolder.java


示例17: onInfo

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public boolean onInfo(PLMediaPlayer plMediaPlayer, int what, int extra) {
    Log.i(TAG, "OnInfo, what = " + what + ", extra = " + extra);
    switch (what) {
        case PLMediaPlayer.MEDIA_INFO_BUFFERING_START:
            break;
        case PLMediaPlayer.MEDIA_INFO_BUFFERING_END:
            break;
        case PLMediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START:
            ToastUtils.s(PlaybackActivity.this, "first video render time: " + extra + "ms");
            break;
        case PLMediaPlayer.MEDIA_INFO_AUDIO_RENDERING_START:
            break;
        case PLMediaPlayer.MEDIA_INFO_VIDEO_FRAME_RENDERING:
            Log.i(TAG, "video frame rendering, ts = " + extra);
            break;
        case PLMediaPlayer.MEDIA_INFO_AUDIO_FRAME_RENDERING:
            Log.i(TAG, "audio frame rendering, ts = " + extra);
            break;
        case PLMediaPlayer.MEDIA_INFO_VIDEO_GOP_TIME:
            Log.i(TAG, "Gop Time: " + extra);
            break;
        case PLMediaPlayer.MEDIA_INFO_SWITCHING_SW_DECODE:
            Log.i(TAG, "Hardware decoding failure, switching software decoding!");
            break;
        case PLMediaPlayer.MEDIA_INFO_METADATA:
            Log.i(TAG, mVideoView.getMetadata().toString());
            break;
        case PLMediaPlayer.MEDIA_INFO_VIDEO_BITRATE:
        case PLMediaPlayer.MEDIA_INFO_VIDEO_FPS:
            Log.i(TAG, "FPS: " + extra);
            break;
        case PLMediaPlayer.MEDIA_INFO_CONNECTED:
            Log.i(TAG, "Connected !");
            break;
        case PLMediaPlayer.MEDIA_INFO_VIDEO_ROTATION_CHANGED:
            Log.i(TAG, "Rotation Changed: " + extra);
            mVideoView.setDisplayOrientation(360 - extra);
            break;
        default:
            break;
    }
    return true;
}
 
开发者ID:pili-engineering,项目名称:PLDroidShortVideo,代码行数:45,代码来源:PlaybackActivity.java


示例18: onCompletion

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public void onCompletion(PLMediaPlayer plMediaPlayer) {
    Log.i(TAG, "Play Completed !");
    ToastUtils.s(PlaybackActivity.this, "Play Completed !");
    finish();
}
 
开发者ID:pili-engineering,项目名称:PLDroidShortVideo,代码行数:7,代码来源:PlaybackActivity.java


示例19: onBufferingUpdate

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public void onBufferingUpdate(PLMediaPlayer plMediaPlayer, int precent) {
    Log.i(TAG, "onBufferingUpdate: " + precent);
}
 
开发者ID:pili-engineering,项目名称:PLDroidShortVideo,代码行数:5,代码来源:PlaybackActivity.java


示例20: onVideoSizeChanged

import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public void onVideoSizeChanged(PLMediaPlayer plMediaPlayer, int width, int height) {
    Log.i(TAG, "onVideoSizeChanged: width = " + width + ", height = " + height);
}
 
开发者ID:pili-engineering,项目名称:PLDroidShortVideo,代码行数:5,代码来源:PlaybackActivity.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DecimalTypeInfo类代码示例发布时间:2022-05-22
下一篇:
Java CollectionAdminResponse类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap