我正在尝试使用 vxg移动sdk 媒体捕获编码器进行实时流式传输。它在设备上成功运行,但流式传输服务器显示
视频源离线错误
在IOS设备中使用相同的网址成功完成流式传输。我正在发布android代码和错误屏幕截图。screenshot 请帮助我
public class MainActivity extends Activity implements MediaCaptureCallback {
MediaCapture capturer;
boolean misAudioEnabled = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Create Capturer instance
capturer = (MediaCapture)findViewById(R.id.captureView);
//adjust Capturer’ config
String svbitrate = "700";//settings.getString("HRVbitrate", "700");
int vbitrate = 700;//1000;
try{
vbitrate = Integer.parseInt(svbitrate);
}catch(NumberFormatException e){
e.printStackTrace();
}
String sabitrate = "64";//settings.getString("audio_bitrate", "64");
int abitrate = 64;//128;
try{
abitrate = Integer.parseInt(sabitrate);
}catch(NumberFormatException e){
e.printStackTrace();
}
MediaCaptureConfig config = capturer.getConfig();
//config.setUrl("rtmp://u1m4c4:testtest@132.145.150.198:1935/push/u1m4c4_rtmppublish");
//config.setUrl(1, "rtmp://u1m4c4:testtest@132.145.150.198:1935/push/u1m4c4_rtmppublish");
int ncm = config.getCaptureMode();
if(misAudioEnabled){
ncm |= MediaCaptureConfig.CaptureModes.PP_MODE_AUDIO.val();
}else{
ncm &= ~(MediaCaptureConfig.CaptureModes.PP_MODE_AUDIO.val());
}
config.setStreaming(true);
config.setCaptureMode(ncm);
//config.setAudioFormat(MediaCaptureConfig.TYPE_AUDIO_AAC);
config.setVideoBitrate(abitrate);
//config.setAudioSamplingRate(44100); //hardcoded
//config.setAudioChannels(2);
try {
config.setUrl(0, URLEncoder.encode("rtmp://u1m11c11:123456@132.145.150.198:1935/push/u1m11c11_rtmppublish", "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//rtmp://u1m4c4:testtest@132.145.150.198:1935/push/u1m4c4_rtmppublish
config.setvideoOrientation(0); //landscape
config.setVideoFramerate(30);
config.setVideoBitrate(vbitrate);
//open the Capturer
capturer.Open(null, this);
capturer.Start();
capturer.StartStreaming();
capturer.StartRecording();
capturer.StartTranscoding();
//capturer.startStr
}