本文整理匯總了Java中android.media.MediaMuxer.start方法的典型用法代碼示例。如果您正苦於以下問題:Java MediaMuxer.start方法的具體用法?Java MediaMuxer.start怎麽用?Java MediaMuxer.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.media.MediaMuxer
的用法示例。
在下文中一共展示了MediaMuxer.start方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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");
}
}
示例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.
*/
@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");
}
}
示例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.
*/
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");
}
}
示例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);
mediaMuxer.start();
recording = true;
} else {
throw new IOException("Need be called while stream");
}
}
示例5: open
import android.media.MediaMuxer; //導入方法依賴的package包/類
@Override
public int open(final StreamPublisher.StreamPublisherParam params) {
isStart = false;
trackCnt = 0;
videoTrackIndex = null;
audioTrackIndex = null;
this.params = params;
super.open(params);
try {
mMuxer = new MediaMuxer(params.outputFilePath,
MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);
} catch (IOException e) {
e.printStackTrace();
}
frameSender = new FrameSender(new FrameSender.FrameSenderCallback(){
@Override
public void onStart() {
isStart = true;
mMuxer.start();
}
@Override
public void onSendVideo(FramePool.Frame sendFrame) {
if (isStart) {
mMuxer.writeSampleData(videoTrackIndex, ByteBuffer.wrap(sendFrame.data), sendFrame.bufferInfo.getBufferInfo());
}
}
@Override
public void onSendAudio(FramePool.Frame sendFrame) {
if (isStart) {
mMuxer.writeSampleData(audioTrackIndex, ByteBuffer.wrap(sendFrame.data), sendFrame.bufferInfo.getBufferInfo());
}
}
@Override
public void close() {
isStart = false;
if (mMuxer != null) {
mMuxer.stop();
mMuxer.release();
mMuxer = null;
}
}
});
return 1;
}