机器环境 DJI_MINI_2
下载了大疆官方SDK,在认证完毕后调用推流方法:
DJISDKManager.getInstance().getLiveStreamManager().setLiveUrl(liveShowUrl);
int result = DJISDKManager.getInstance().getLiveStreamManager().startStream();
结果result返回 -3。
大疆没有相关返回值说明,从网上查询后获取:-3代表没有获取到视频流的SPS和PPS。
https://cloud.tencent.com/developer/ask/sof/818590
https://bbs.dji.com/forum.php?mod=viewthread&tid=258606
后来经过以下操作获取流媒体:
<com.dji.sdk.sample.internal.utils.VideoFeedView
android:id="@+id/video_view_primary_video_feed"
style="@style/main_camera_view"
android:layout_width="300dp"
android:layout_height="200dp"
android:layout_alignParentBottom="false"
android:layout_marginTop="30dp" />
private boolean isPrimaryVideoFeed = true;
无法推流原因应该DJI_MINI_2是需要一个转码的操作,该操作在创建videofeedview中进行实现
codecManager = new DJICodecManager(context,
surfaceHolder,
getWidth(),
getHeight(),
isPrimaryVideoFeed
? UsbAccessoryService.VideoStreamSource.Camera
: UsbAccessoryService.VideoStreamSource.Fpv);
...
...
...
codecManager.sendDataToDecoder(videoBuffer,
size,
isPrimaryVideoFeed
? UsbAccessoryService.VideoStreamSource.Camera.getIndex()
: UsbAccessoryService.VideoStreamSource.Fpv.getIndex());