agora-rtc-react icon indicating copy to clipboard operation
agora-rtc-react copied to clipboard

LocalVideoTrack and LocalAudio track not publishing

Open Snehasish7080 opened this issue 1 year ago • 6 comments

What kind of problem do you need help?

LocalVideoTrack and LocalAudio track not publishing if user leave the channel and rejoin the same channel in next js chrome browser but it's working fine if I am using in private window of browser

Snehasish7080 avatar Oct 10 '24 12:10 Snehasish7080

@Snehasish7080 pls give me some error logs when you are encounter issues in next js chrome browser

guoxianzhe avatar Oct 11 '24 02:10 guoxianzhe

@guoxianzhe it is not showing any kind of error but when joining in first time the publis successful message can be shown in console but when we try to rejoin the same session there no message regarding publish. And these are the current scenario logs.

10:59:07:714 Agora-SDK [INFO]: [client-7f128] Joining channel success: channel: 669dfd4209f23fa94c0413926708b739321849e54ebad740,uid: 3641061825 4b7a68ae.f4cf781d1ea02768.js:1 10:59:07:726 Agora-SDK [INFO]: [client-7f128] [p2pId: 1]: P2PConnection.onICEConnectionStateChange(checking) 4b7a68ae.f4cf781d1ea02768.js:1 10:59:07:727 Agora-SDK [DEBUG]: [lock-P2PConnection-mutex-23] is not locked, current queue 0. From P2PConnection.connect 4b7a68ae.f4cf781d1ea02768.js:1 10:59:07:727 Agora-SDK [DEBUG]: [lock-P2PChannel-mutex-15] is not locked, current queue 0. From P2PChannel.connect 4b7a68ae.f4cf781d1ea02768.js:1 10:59:07:727 Agora-SDK [INFO]: [client-7f128] [p2pId: 1]: P2PConnection.onConnectionStateChange(connecting) 4b7a68ae.f4cf781d1ea02768.js:1 10:59:07:747 Agora-SDK [INFO]: [client-7f128] [pc-1] selectedcandidatepairchange: local {"candidateType":"prflx","protocol":"udp"}, remote {"candidateType":"host","protocol":"udp","address":"129.227.205.66","port":4715} ) 4b7a68ae.f4cf781d1ea02768.js:1 10:59:07:747 Agora-SDK [INFO]: [client-7f128] [p2pId: 1]: P2PConnection.onDTLSTransportStateChange(connecting) 4b7a68ae.f4cf781d1ea02768.js:1 10:59:07:748 Agora-SDK [INFO]: [client-7f128] [p2pId: 1]: P2PConnection.onICEConnectionStateChange(connected) 4b7a68ae.f4cf781d1ea02768.js:1 10:59:07:748 Agora-SDK [INFO]: [client-7f128] [p2pId: 1]: P2PConnection.onICETransportStateChange(connected) 4b7a68ae.f4cf781d1ea02768.js:1 10:59:07:749 Agora-SDK [DEBUG]: [client-7f128] [pc-1] local candidate count 1 4b7a68ae.f4cf781d1ea02768.js:1 10:59:07:780 Agora-SDK [INFO]: [client-7f128] [p2pId: 1]: P2PConnection.onDTLSTransportStateChange(connected) 4b7a68ae.f4cf781d1ea02768.js:1 10:59:07:782 Agora-SDK [INFO]: [client-7f128] [p2pId: 1]: P2PConnection.onConnectionStateChange(connected) 4b7a68ae.f4cf781d1ea02768.js:1 10:59:07:921 Agora-SDK [INFO]: [client-7f128] [p2pId: 1]: P2PConnection.SelectedLocalCandidateChanged({"candidateType":"unknown","address":"unknown","port":0,"protocol":"unknown"} -> {"candidateType":"prflx","protocol":"udp"}) 4b7a68ae.f4cf781d1ea02768.js:1 10:59:07:921 Agora-SDK [INFO]: [client-7f128] [p2pId: 1]: P2PConnection.SelectedRemoteCandidateChanged({"candidateType":"unknown","address":"unknown","port":0,"protocol":"unknown"} -> {"candidateType":"host","address":"129.227.205.66","port":4715,"protocol":"udp"}) 4b7a68ae.f4cf781d1ea02768.js:1 10:59:08:140 Agora-SDK [DEBUG]: [lock-P2PChannel-mutex-15] is locked, current queue 1. From P2PChannel.updateRemoteRTPCapabilities 4b7a68ae.f4cf781d1ea02768.js:1 10:59:08:141 Agora-SDK [DEBUG]: [lock-P2PConnection-mutex-23] is locked, current queue 1. From P2PConnection.updateRemoteRTPCapabilities 4b7a68ae.f4cf781d1ea02768.js:1 10:59:08:141 Agora-SDK [DEBUG]: [lock-P2PChannel-mutex-15] is not locked, current queue 0. From P2PChannel.updateRemoteRTPCapabilities 4b7a68ae.f4cf781d1ea02768.js:1 10:59:08:141 Agora-SDK [DEBUG]: updateRemoteCodec, from vp9,av1,vp8,h264 to vp8,h264 4b7a68ae.f4cf781d1ea02768.js:1 10:59:08:147 Agora-SDK [DEBUG]: [lock-P2PConnection-mutex-23] is not locked, current queue 0. From P2PConnection.updateRemoteRTPCapabilities 4b7a68ae.f4cf781d1ea02768.js:1 11:01:07:715 Agora-SDK [DEBUG]: preload channel 669dfd4209f23fa94c0413926708b739321849e54ebad740, uid is 3641061825

Snehasish7080 avatar Oct 11 '24 05:10 Snehasish7080

@Snehasish7080 Yes, I didn't see any publish action being triggered in the logs after you joined the channel. How does your code handle rejoining the channel? Are you triggering publish again?

guoxianzhe avatar Oct 11 '24 07:10 guoxianzhe

@guoxianzhe I am using

usePublish([
    localMicrophoneTrack,
    localCameraTrack,
    screenVideoTrack,
    screenAudioTrack,
  ]);

hook for this currently. In this I am closing the tab on leaving the channel and when user rejoin the channel on page load it should be triggered automatically.

Snehasish7080 avatar Oct 11 '24 11:10 Snehasish7080

@Snehasish7080

you can only publish 1 video track in one RTCProvider, you sholud publish localCameraTrack in AgoraRTCProvider and publish screenVideoTrack in AgoraRTCScreenShareProvider

guoxianzhe avatar Oct 14 '24 03:10 guoxianzhe

@guoxianzhe there is only one RTCProvider and I am publishing one video track as on page load it will re initiate everything. Currently I am doing like this. const AgoraComponent = () => { const client = AgoraRTC.createClient({ mode: "rtc", codec: "vp8" }); client.enableAudioVolumeIndicator(); return ( <StrictMode> <AgoraRTCProvider client={client}> <AgoraRTCScreenShareProvider client={client}> <VideoComponent client={client} /> </AgoraRTCScreenShareProvider> </AgoraRTCProvider> </StrictMode> ); };

<VideoComponent client={client} /> is containing all the necessary code for the video track and other things. And I am in next js.

Snehasish7080 avatar Oct 15 '24 07:10 Snehasish7080