-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Joining channel without calling "start preview" on web doesn't listen for remote video stream #1789
Comments
Does it work on native? |
Hi, Could you please share the log of your testing session in which you encountered the issue? It would be helpful if you could clean the console log before testing the issue for the first time and avoid any extra actions during the test. To retrieve the console log, right click on the web page, select "inspect" and then go to the "console" tab. Please copy and send us the complete console SDK log for further investigation. Thank you. |
Yes native is working fine |
Forgot to mention the problem is mainly on mobile browsers. I will add the logs later in the day, thanks. |
Hello, after testing again on the example agora app, it seems it works fine and the issue remaining on our app. I will further investigate what could cause this issue and will come back with more info. Thanks for the help |
I am attaching the piece of code that initializes rtc and joining the channel (also this code was working fine on agora v5.x) try {
final rtcEngine = createAgoraRtcEngine();
await rtcEngine.initialize(RtcEngineContext(
appId: appId,
areaCode: AreaCode.areaCodeEu.value(),
logConfig: const LogConfig(level: LogLevel.logLevelInfo),
));
_setRtcListeners(rtcEngine);
disposableContainer.addDisposable(rtcEngine.release);
_rtcEngine = rtcEngine;
// Explain to user why we need the microphone permission
await Permission.microphone.isGranted.then<void>((bool hasMicPermission) async {
if (!hasMicPermission) {
final completer = Completer<void>();
emitSideEffectEvent(LiveSessionEvent.showPermissionsExplanationDialog(
onComplete: completer.complete,
));
await completer.future;
}
});
// request the appropriate permissions based on the appointment type
final permissionsResult = await [
Permission.microphone,
if (appointment.type == AppointmentType.video) Permission.camera,
].request();
// cancel further initialization as microphone permission is rquired
if (!permissionsResult[Permission.microphone]!.isGranted) {
emitSideEffectEvent(const LiveSessionEvent.showPermissionsDeniedDialog());
return const _RtcInitResult(initSuccessfully: false);
}
await rtcEngine.muteLocalAudioStream(false);
await rtcEngine.setVideoEncoderConfiguration(VideoEncoderConfiguration(
orientationMode: OrientationMode.orientationModeFixedPortrait,
degradationPreference: DegradationPreference.maintainBalanced,
frameRate: FrameRate.frameRateFps30.value(),
mirrorMode: VideoMirrorModeType.videoMirrorModeEnabled,
));
await rtcEngine.enableVideo();
if (permissionsResult[Permission.camera]?.isGranted ?? false) {
await _enableLocalVideo(true);
await rtcEngine.startPreview();
} else {
await _enableLocalVideo(false);
}
return _RtcInitResult(
initSuccessfully: true,
grantedCameraPermission: permissionsResult[Permission.camera]?.isGranted ?? false,
);
} catch (exception, stackTrace) {
Logger.error(
'live-session-init',
exception: exception,
stackTrace: stackTrace,
);
emitSideEffectEvent(const LiveSessionEvent.failedToInitializeSession());
return const _RtcInitResult(initSuccessfully: false);
} If initializatio is succesful _rtcEngine!.joinChannel(
token: ok.data.channelToken,
channelId: _appointmentId,
uid: _me.isCustomer ? _kAgoraCustomerId : _kAgoraDoctorId,
options: const ChannelMediaOptions(
channelProfile: ChannelProfileType.channelProfileCommunication,
clientRoleType: ClientRoleType.clientRoleBroadcaster,
),
); Camera toggle for remote void toggleCameraForRemote() async {
try {
if (dataState.snapshot.isCameraOpened) {
await rtcEngine.stopPreview();
await _enableLocalVideo(false);
state = dataState.copyWith(
snapshot: dataState.snapshot.copyWith(
isCameraOpened: false,
));
return;
}
final permission = await Permission.camera.request();
if (!permission.isGranted) {
emitSideEffectEvent(const LiveSessionEvent.showPermissionsDeniedDialog(shouldExitSession: false));
return;
}
await rtcEngine.enableVideo();
await _enableLocalVideo(true);
await rtcEngine.startPreview();
state = dataState.copyWith(
snapshot: dataState.snapshot.copyWith(
isCameraOpened: true,
));
} catch (exception, stackTrace) {
Logger.error(
'live-session-toggle-camera',
exception: exception,
stackTrace: stackTrace,
);
}
} Self preview widget ...
state.snapshot.isCameraOpened
? Material(
elevation: 3.0,
shape: const CircleBorder(),
child: ClipRRect(
borderRadius: BorderRadius.circular(65.0),
child: AgoraVideoView(
controller: VideoViewController(
rtcEngine: state.snapshot.rtcEngine,
canvas: const VideoCanvas(uid: 0),
),
),
),
)
: Ui.empty,
... final LiveSessionDataState snapshot = dataState.snapshot;
final int? remoteRtcUid = snapshot.remoteUserRtcUid;
if (remoteRtcUid == null || remoteRtcUid == -1) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
ScaleTransition(
scale: _scaleAnimation,
child: Avatar(
radius: 64.0,
placeholder: const Icon(Icons.person),
loading: const CircularProgressIndicator(),
url: snapshot.remoteUser.photoUrl,
),
),
Ui.vspace8,
if (snapshot.remoteUserRtcUid == -1)
Text('Αποσυνδέθηκε', style: context.theme.textTheme.titleLarge)
else
Text('Αναμένεται σύνδεση..', style: context.theme.textTheme.bodySmall),
],
);
}
if (!kIsWeb && !snapshot.isRemoteCameraOpen) {
return Avatar(
radius: 64.0,
placeholder: const Icon(Icons.person),
loading: const CircularProgressIndicator(),
url: snapshot.remoteUser.photoUrl,
);
}
return AgoraVideoView(
controller: VideoViewController.remote(
rtcEngine: snapshot.rtcEngine,
connection: RtcConnection(channelId: snapshot.appointment.id),
canvas: VideoCanvas(uid: remoteRtcUid),
),
); |
Hello @spideythewebhead, as you mentioned above, what mobile browsers(iOS Safari/chrome, Android Chrome?) are encountering the issue? I think the logs are helpful for further investigation, is it possible to share the logs in the console? You can inspect the mobile browsers to get the logs |
The code seems ok. Better we have sdk log to take a further look. If it is difficult to get the console log. You can also provide us the channel name so that we can take a rough check with the channel log for the first step on our end. |
Hello, will do later the day, thanks |
Sorry for the delay here are the logs from a session using an android and an iphone.. let me know if you need anything else |
Based on your log https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/files/15488453/iphone14_ios16_safari.txt, it is most likely the remote user had not published the video, I think this is why you can receive the remote user's video. |
Yes exactly but that's the problem even if I call these method that enable the camera after joining a channel the remotes don't receive the streams.. if I do it before it does.. but probably this is some big in my code as it seems to be working on the example app... Even tho I can't figure out why |
I think you should call |
Hi I have added the call you suggested and now the remote can see the local user fine. I am just wondering why this works fine on the mobile and not on the web, is this a difference between the native implementations? Also something else is that while I am updating the channel options the remote microphone stream is unsubscribed and the audio is lost for couple of seconds.. I will search it further and will come back with more info |
Sadly whatever I do some other problem will pop on the web.. so sadly we will stay on 5.x. Thanks |
We're so sorry that this issue blocked your upgrade, the web support on 6.x is still in the alpha stage, and many thanks for your feedback.
I think these issues above should be bugs. We aim to keep the APIs behave the same across the platforms unless there are limitations on the platforms. We will take a look at these issues later, I will update here if there's any progress. |
Version of the agora_rtc_engine
6.3.1
Platforms affected
Steps to reproduce
createAgoraRtcEngineEx
&engine.initialize
engine.enableVideo
engine.joinChannel
=> doesn't receive remote video streamengine.startPreview
&enableLocalVideo
=> remote users don't receive video stream & local user doesn't receive remote video streamExpected results
In our app request the necessary permissions for microphone/camera based on some conditions.
Then the app calls the
enableVideo
method and if the user has accepted the request for accessing the camera, then the app callsstartPreview
and followed byenableLocalVideo
.If the user has declined the camera access before joining the channel - which means
startPreview
andenableLocalVideo
won't be called- the user doesn't seem to receive events related to the video stream from a remote user.Now if you requested the camera permission, get access and call these 2 methods nothing happens.
Actual results
Code sample
Code sample
[Paste your code here]
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]
Flutter Doctor output
Doctor output
[Paste your output here]
The text was updated successfully, but these errors were encountered: