本文整理汇总了Java中com.pili.pldroid.player.PLMediaPlayer类的典型用法代码示例。如果您正苦于以下问题:Java PLMediaPlayer类的具体用法?Java PLMediaPlayer怎么用?Java PLMediaPlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PLMediaPlayer类属于com.pili.pldroid.player包,在下文中一共展示了PLMediaPlayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例13: onPrepared
import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public void onPrepared(PLMediaPlayer mp) {
Log.i(TAG, "On Prepared !");
startPlayer();
mIsStopped = false;
}
示例14: onBufferingUpdate
import com.pili.pldroid.player.PLMediaPlayer; //导入依赖的package包/类
@Override
public void onBufferingUpdate(PLMediaPlayer mp, int percent) {
// Log.d(TAG, "onBufferingUpdate: " + percent + "%");
}
示例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 播放完成
}