use of com.lansosdk.videoeditor.MediaInfo in project LanSoEditor_advance by LanSoSdk.
the class VideoLayerTransformActivity method startPlayVideo.
private void startPlayVideo() {
mInfo = new MediaInfo(mVideoPath, false);
if (mInfo.prepare()) {
mplayer = new MediaPlayer();
try {
mplayer.setDataSource(mVideoPath);
} catch (IOException e) {
e.printStackTrace();
}
mplayer.setOnPreparedListener(new OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
// TODO Auto-generated method stub
initDrawPad();
}
});
mplayer.prepareAsync();
} else {
Log.e(TAG, "Null Data Source\n");
finish();
return;
}
}
use of com.lansosdk.videoeditor.MediaInfo in project LanSoEditor_advance by LanSoSdk.
the class MVLayerDemoActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mvlayer_demo_layout);
initView();
mVideoPath = getIntent().getStringExtra("videopath");
mDrawPadView = (DrawPadView) findViewById(R.id.id_mvlayer_padview);
mInfo = new MediaInfo(mVideoPath, false);
if (mInfo.prepare() == false) {
Log.e(TAG, "视频源文件错误!");
this.finish();
}
// 在手机的默认路径下创建一个文件名,用来保存生成的视频文件,(在onDestroy中删除)
editTmpPath = SDKFileUtils.newMp4PathInBox();
dstPath = SDKFileUtils.newMp4PathInBox();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
startPlayVideo();
}
}, 500);
}
use of com.lansosdk.videoeditor.MediaInfo in project LanSoEditor_advance by LanSoSdk.
the class VHeaderConcat method start.
public void start(Context ctx, String videoHeader, String recordVideo) {
this.recordVideo = recordVideo;
videoPath = videoHeader;
mInfo = new MediaInfo(recordVideo);
if (mInfo.prepare()) {
int padWidth = mInfo.vWidth;
int padHeight = mInfo.vHeight;
if (mInfo.vRotateAngle == 90 || mInfo.vRotateAngle == 270) {
padWidth = mInfo.vHeight;
padHeight = mInfo.vWidth;
}
editTmpPath = SDKFileUtils.newMp4PathInBox();
dstPath = SDKFileUtils.newMp4PathInBox();
/**
* 片头缩放成 recordVideo的尺寸.
*/
mDrawPad = new DrawPadVideoExecute(ctx, videoPath, padWidth, padHeight, (int) (mInfo.vBitRate * 1.5f), null, editTmpPath);
mDrawPad.setUseMainVideoPts(true);
/**
* 设置DrawPad处理完成后的监听.
*/
mDrawPad.setDrawPadCompletedListener(new onDrawPadCompletedListener() {
@Override
public void onCompleted(DrawPad v) {
// TODO Auto-generated method stub
drawPadCompleted();
}
});
mDrawPad.pauseRecord();
if (mDrawPad.startDrawPad()) {
// 开始恢复处理.
mDrawPad.resumeRecord();
}
}
}
use of com.lansosdk.videoeditor.MediaInfo in project LanSoEditor_advance by LanSoSdk.
the class VideoOneProcessActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video_one_do_process_layout);
mContext = getApplicationContext();
videoPath = getIntent().getStringExtra("videopath");
mInfo = new MediaInfo(videoPath);
if (mInfo.prepare() == false) {
Toast.makeText(mContext, "当前文件错误!", Toast.LENGTH_LONG).show();
finish();
}
initUI();
}
use of com.lansosdk.videoeditor.MediaInfo in project LanSoEditor_advance by LanSoSdk.
the class VideoPlayerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.player_layout);
textureView = (TextureRenderView) findViewById(R.id.surface1);
videoPath = getIntent().getStringExtra("videopath");
TextView tvScreen = (TextView) findViewById(R.id.id_palyer_screenhinit);
TextView tvVideoRatio = (TextView) findViewById(R.id.id_palyer_videoRatio);
tvVideoDuration = (TextView) findViewById(R.id.id_palyer_videoduration);
tvSizeHint = (TextView) findViewById(R.id.id_palyer_videosizehint);
tvPlayWidget = (TextView) findViewById(R.id.id_palyer_widget);
// 获取屏幕密度(方法2)
DisplayMetrics dm = new DisplayMetrics();
dm = getResources().getDisplayMetrics();
screenWidth = dm.widthPixels;
screenHeight = dm.heightPixels;
String str = "当前屏幕分辨率:";
str += String.valueOf(screenWidth);
str += "x";
str += String.valueOf(screenHeight);
tvScreen.setText(str);
mInfo = new MediaInfo(videoPath, false);
if (mInfo.prepare() == false) {
showHintDialog();
isSupport = false;
} else {
Log.i(TAG, "info:" + mInfo.toString());
isSupport = true;
str = "当前视频分辨率:";
str += String.valueOf(mInfo.vWidth);
str += "x";
str += String.valueOf(mInfo.vHeight);
tvVideoRatio.setText(str);
str = "当前视频时长:";
str += String.valueOf(mInfo.vDuration);
tvVideoDuration.setText(str);
}
textureView.setSurfaceTextureListener(new SurfaceTextureListener() {
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
// TODO Auto-generated method stub
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
return false;
}
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
if (isSupport) {
// 采用系统本身的MediaPlayer播放
play(new Surface(surface));
// startVPlayer(new Surface(surface)); //我们SDK提供的播放器.
}
}
});
}
Aggregations