本文整理匯總了Java中android.media.MediaMuxer.addTrack方法的典型用法代碼示例。如果您正苦於以下問題:Java MediaMuxer.addTrack方法的具體用法?Java MediaMuxer.addTrack怎麽用?Java MediaMuxer.addTrack使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.media.MediaMuxer
的用法示例。
在下文中一共展示了MediaMuxer.addTrack方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addTrack
import android.media.MediaMuxer; //導入方法依賴的package包/類
@Override
public int addTrack(MediaFormat mediaFormat) {
int ret=-1;
synchronized (Lock){
if(!muxStarted){
if(audioTrack==-1&&videoTrack==-1){
try {
mMuxer=new MediaMuxer(path,MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);
} catch (IOException e) {
e.printStackTrace();
AvLog.e("create MediaMuxer failed:"+e.getMessage());
}
}
String mime=mediaFormat.getString(MediaFormat.KEY_MIME);
if(mime.startsWith("audio")){
audioTrack=mMuxer.addTrack(mediaFormat);
ret=audioTrack;
}else if(mime.startsWith("video")){
videoTrack=mMuxer.addTrack(mediaFormat);
ret=videoTrack;
}
startMux();
}
}
return ret;
}
示例2: startRecord
import android.media.MediaMuxer; //導入方法依賴的package包/類
/**
* Start record a MP4 video. Need be called while stream.
*
* @param path where file will be saved.
* @throws IOException If you init it before start stream.
*/
public void startRecord(String path) throws IOException {
if (streaming) {
mediaMuxer = new MediaMuxer(path, MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);
if (videoFormat != null) {
videoTrack = mediaMuxer.addTrack(videoFormat);
}
if (audioFormat != null) {
audioTrack = mediaMuxer.addTrack(audioFormat);
}
mediaMuxer.start();
recording = true;
} else {
throw new IOException("Need be called while stream");
}
}
示例3: startRecord
import android.media.MediaMuxer; //導入方法依賴的package包/類
/**
* Start record a MP4 video. Need be called while stream.
*
* @param path where file will be saved.
* @throws IOException If you init it before start stream.
*/
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
public void startRecord(String path) throws IOException {
if (streaming) {
mediaMuxer = new MediaMuxer(path, MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);
if (videoFormat != null) {
videoTrack = mediaMuxer.addTrack(videoFormat);
}
if (audioFormat != null) {
audioTrack = mediaMuxer.addTrack(audioFormat);
}
mediaMuxer.start();
recording = true;
} else {
throw new IOException("Need be called while stream");
}
}
示例4: startRecord
import android.media.MediaMuxer; //導入方法依賴的package包/類
/**
* Start record a MP4 video. Need be called while stream.
*
* @param path where file will be saved.
* @throws IOException If you init it before start stream.
*/
public void startRecord(String path) throws IOException {
if (streaming) {
mediaMuxer = new MediaMuxer(path, MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);
videoTrack = mediaMuxer.addTrack(videoFormat);
audioTrack = mediaMuxer.addTrack(audioFormat);
mediaMuxer.start();
recording = true;
} else {
throw new IOException("Need be called while stream");
}
}
示例5: startRecord
import android.media.MediaMuxer; //導入方法依賴的package包/類
/**
* Start record a MP4 video. Need be called while stream.
*
* @param path where file will be saved.
* @throws IOException If you init it before start stream.
*/
public void startRecord(String path) throws IOException {
if (streaming) {
mediaMuxer = new MediaMuxer(path, MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);
videoTrack = mediaMuxer.addTrack(videoFormat);
mediaMuxer.start();
recording = true;
} else {
throw new IOException("Need be called while stream");
}
}