Comments (14)
Hello, thanks for report the issue.
For the provided the channel name c5769006-1f82-45a1-9cdf-349546c84a68@Test1, seems you have created lots of channel with same id. If it is convent, can you reproduce this issue again with a different channel name? Then we could have check on the backend.
from agorawebsdk-ng.
Thanks for the reply. Sure, that's the new channel: appercode_test_c5769006-1f82-45a1-9cdf-349546c84a68@Test1
The behavior is kinda inconsistent, as of now I can't find the exact conditions when it happens.
Thanks for your help
from agorawebsdk-ng.
@tsyrya
For subscribe remote user audio/video track, did you try below:
client.on("user-published", async (user, mediaType) => {
// Initiate the subscription
await client.subscribe(user, mediaType);
// If the subscribed track is an audio track
if (mediaType === "audio") {
const audioTrack = user.audioTrack;
// Play the audio
audioTrack.play();
} else {
const videoTrack = user.videoTrack;
// Play the video
videoTrack.play(DOM_ELEMENT);
}
});
If your logic is different, can you share the same here?
from agorawebsdk-ng.
Yeah, the logic is similar. That's how I subscribe to the user-published event:
this.client.on(AgoraUserEvents.UserPublished, this.handlePublished.bind(this));
In the handler there is some logic, but I do console.log immediately and I get audioTrack: undefined
async handlePublished(user: IAgoraRTCRemoteUser, mediaType: AgoraMediaType): Promise<void> {
console.log('user published', user);
mediaType == AgoraMediaTypeEnum.Audio && await this.client.subscribe(user, AgoraMediaTypeEnum.Audio);
mediaType == AgoraMediaTypeEnum.Video && await this.client.subscribe(user, AgoraMediaTypeEnum.Video);
...some logic
}
from agorawebsdk-ng.
Yeah, the logic is similar. That's how I subscribe to the user-published event:
this.client.on(AgoraUserEvents.UserPublished, this.handlePublished.bind(this));
In the handler there is some logic, but I do console.log immediately and I get audioTrack: undefined
async handlePublished(user: IAgoraRTCRemoteUser, mediaType: AgoraMediaType): Promise<void> { console.log('user published', user); mediaType == AgoraMediaTypeEnum.Audio && await this.client.subscribe(user, AgoraMediaTypeEnum.Audio); mediaType == AgoraMediaTypeEnum.Video && await this.client.subscribe(user, AgoraMediaTypeEnum.Video); ...some logic }
In this case, the current MediaType is "video", right?
Will you get another event with MediaType as "audio"?
from agorawebsdk-ng.
Yeah, the event fires 2 times, but in both cases the autioTrack property is undefined.
from agorawebsdk-ng.
that's the full log of the object when the mediaType = 'audio':
uid: "770"
_audio_added_: true
_audio_enabled_: true
_audio_muted_: false
_trust_audio_enabled_state_: true
_trust_audio_mute_state_: true
_trust_in_room_: true
_trust_stream_added_state_: true
_trust_video_enabled_state_: true
_trust_video_mute_state_: true
_uintid: 10022
_videoTrack: nd {…}
_video_added_: true
_video_enabled_: true
_video_muted_: false
audioTrack: undefined
hasAudio: true
hasVideo: true
videoTrack: nd
from agorawebsdk-ng.
Yeah, the event fires 2 times, but in both cases the autioTrack property is undefined.
So far, we didn't receive issue like this from any other users..
do you have a chance to try on different environment? For example, use two different PC and different browsers.. , etc
from agorawebsdk-ng.
We have tried different devices and browsers, it happens time to time. I don’t deny that it might be our code’s problem. But I have difficulties to narrow down the case. Maybe you can give me a hint where I can dig in. Like in what cases it might be that hasVolume: true, but audioTrack is undefined (maybe I publish it wrong). Also as you see based on the log information the track was published successfully.
Thank you.
from agorawebsdk-ng.
that's how I publish
let [localAudioTrack, localVideoTrack] = await Promise.all([
this.createAudioTrack(),
this.createVideoTrack()
]);
await this.client.publish([localAudioTrack, localVideoTrack]);
for now All I do in the user-published event is
console.log('user published', user, mediaType);
await this.client.subscribe(user, mediaType);
from agorawebsdk-ng.
Could it because I do subscription with a delay, because before I subscribe there is a user rights checking logic?
from agorawebsdk-ng.
that's how I publish
let [localAudioTrack, localVideoTrack] = await Promise.all([ this.createAudioTrack(), this.createVideoTrack() ]); await this.client.publish([localAudioTrack, localVideoTrack]);
for now All I do in the user-published event is
console.log('user published', user, mediaType); await this.client.subscribe(user, mediaType);
If you publish audio and video track separately, can make the things different?
from agorawebsdk-ng.
Well, seems like my problem is gone if I remove my checking role logic before subscription. I don't really understand why thought :) When the user-published event is fired, the user parameter of the handler is a link to the same object in both audio and video cases? Maybe I somehow messed up with the object, because I was keeping it in the memory while checking the rights. I will test more and let you know the results once I am done. Thank you for your help!
from agorawebsdk-ng.
To be honest I still don't know what the problem was, but it is working stable now. Thank you for your help
from agorawebsdk-ng.
Related Issues (20)
- If the connection is lost and the token is about to expire after reestablishing the connection agora doesn't fire connection-state-change event HOT 1
- webNG sdk publish和unpublish事件与小程序互通问题 HOT 1
- TO ADD NEW FEATURES HOT 1
- RR HOT 1
- Can't rejoin channel after token has expired HOT 1
- Audio issues in safari browser in MacOS HOT 2
- How can I join/rejoin an ongoing meeting? HOT 1
- TypeError: Cannot assign to read only property '_trust_audio_mute_state_' of object '#<Ho>' HOT 1
- Video goes black while the other side is uploading a file or switch background mode HOT 5
- can not receive user-published event but see log [remote user xxx published video/audio] HOT 9
- "export 'default' (imported as 'AgoraRTC') was not found in 'agora-rtc-sdk-ng' HOT 11
- If a user for some reason has some network restrictions, then the client keeps on trying to join infinitely. HOT 1
- How to connect native client to web client ? HOT 5
- Unable to connect Web sdk user to native Sdk user HOT 2
- In chrome, if a tab with the stream is inactive for some time the readyState of the media tracks becomes ended and they stop playing HOT 1
- Unable to change the time in AudioVolumeIndicator HOT 1
- subscribe user 2444849064 error TypeError: b is not a function
- How to eliminate the delay when you press Stop Screen Sharing HOT 2
- React Demo bug HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from agorawebsdk-ng.