AgoraIO-Extensions / AgoraIO-Extensions/Agora-Flutter-SDK

Why i'm getting same remote id for multiple stream.

Abierto
#2,465 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Dart
Estrellas
795
Forks
448
Merge medio
12 h 19 min
PR fusionados (30 d)
14

Descripción

I want to show the multiple video stream in one screen like cctv camera view. but only play the first stream and other remaining stream not playing.
I have notice one point is, i have do the loop to createAgoraRtcEngine each and every stream separately but getting same remote id for all the stream.

Please help me for this how i can play all the stream parallel.

below i have mention the code for understanding.


snapShot.requireData.forEach((element) async {
{
_playAutoPlay(cameraModel: element);
await Future.delayed(const Duration(seconds: 5));
}
});

void _playAutoPlay({required CCRoomAgoraModel cameraModel}) async
{
isLoaded = false;
await initAgora(cameraModel: cameraModel);
await Future.delayed(const Duration(milliseconds: 500));
await agoraStartStream(cameraModel: cameraModel);
roomController.update();
}

Future initAgora({required CCRoomAgoraModel cameraModel}) async {
try {
cameraModel.agoraEngine = createAgoraRtcEngine();
await cameraModel.agoraEngine!.initialize(
RtcEngineContext(
appId: CCConfig.agoraAppId,
channelProfile: ChannelProfileType.channelProfileLiveBroadcasting,
),
);

// Enable video
await cameraModel.agoraEngine!.enableVideo();
cameraModel.isInitialized = true;
// Register event handler
cameraModel.agoraEngine!.registerEventHandler(
RtcEngineEventHandler(
onJoinChannelSuccess: (RtcConnection connection, int elapsed) {

},
onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
CCPrint(name: "AgoraCheck", value: "Remote ID: ${remoteUid.toString()} == Camera Name: ${cameraModel.equipment_name} ",
);
cameraModel.remoteUid = remoteUid;
cameraModel.isLive = true;
setState(() {});
},
onUserOffline: (
RtcConnection connection,
int uid,
UserOfflineReasonType reason,
) {
CCPrint(name: "AgoraCheck", value: "onUserOffline");
cameraModel.isLive = false;
setState(() {});

},
onLeaveChannel: (RtcConnection connection, RtcStats stats) {
CCPrint(name: "AgoraCheck", value: "onLeaveChannel");

},
onError: (ErrorCodeType err, String msg) {

},
onRtcStats: (RtcConnection connection, RtcStats stats) {

},
),
);


} catch (e) {
CCPrint(name: "AgoraCheck", value: "init catch $e");
}
}

Future agoraStartStream({required CCRoomAgoraModel cameraModel}) async {
try {
// statusMessage.value = 'Connecting to broadcast...';

// Set user role as audience (viewer)
await cameraModel.agoraEngine!.setClientRole(
role: ClientRoleType.clientRoleAudience,
);

// Join channel
await cameraModel.agoraEngine!.joinChannel(
token: cameraModel.agora_token,
channelId: cameraModel.equipment_code.toString(),
uid: int.parse(cameraModel.remoteUid.toString()),
options: ChannelMediaOptions(
clientRoleType: ClientRoleType.clientRoleAudience,
autoSubscribeAudio: true,
autoSubscribeVideo: true,
publishMicrophoneTrack: false,
// Viewer doesn't send audio
publishCameraTrack: false,
// Viewer doesn't send video
channelProfile: ChannelProfileType.channelProfileLiveBroadcasting,
),
);
setState(() {});
} catch (e) {
CCPrint(name: "AgoraCheck", value: "start catch $e");
}
}

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.