| | |
| | | private void startMedia(MediaArgu media) { |
| | | if (media == null) { |
| | | Timber.w("startMedia: media is null"); |
| | | notifyCallback(1, -1, "MediaArgu is null"); |
| | | notifyCallback(1, -1, "MediaArgu is null",1); |
| | | return; |
| | | } |
| | | |
| | |
| | | p2Service.startMedia(media); |
| | | } catch (RemoteException e) { |
| | | Timber.e(e, "startMedia forward to P2 failed"); |
| | | notifyCallback(1, -3, "启动P2服务失败: " + e.getMessage()); |
| | | notifyCallback(1, -3, "启动P2服务失败: " + e.getMessage(),2); |
| | | } |
| | | } else { |
| | | // 等待连接完成后执行 |
| | |
| | | usbCameraPushManager.startPush(media); |
| | | } else { |
| | | Timber.w("推流仅支持USB摄像头"); |
| | | notifyCallback(1, -4, "推流仅支持USB摄像头"); |
| | | notifyCallback(1, -4, "推流仅支持USB摄像头",1); |
| | | } |
| | | } else { |
| | | // 录像 |
| | |
| | | * @param type 类型:0-录像 1-推流 2-文件名类型等 |
| | | * @param errCode 错误码:0-成功,其他为错误码 |
| | | * @param message 消息内容 |
| | | * @param cameraId 0-android camera 1-P1 usb 2-P2 usb |
| | | */ |
| | | private void notifyCallback(int type, int errCode, String message) { |
| | | private void notifyCallback(int type, int errCode, String message,int cameraId) { |
| | | ResponseVO response = new ResponseVO(); |
| | | response.setType(type); |
| | | response.setCameraId(cameraId); |
| | | response.setErrCode(errCode); |
| | | response.setMessage(message); |
| | | notifyCallback(response); |