Giter Club home page Giter Club logo

Comments (14)

yoreland avatar yoreland commented on July 3, 2024

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.

tsyrya avatar tsyrya commented on July 3, 2024

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.

yoreland avatar yoreland commented on July 3, 2024

@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.

tsyrya avatar tsyrya commented on July 3, 2024

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.

yoreland avatar yoreland commented on July 3, 2024

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.

tsyrya avatar tsyrya commented on July 3, 2024

Yeah, the event fires 2 times, but in both cases the autioTrack property is undefined.

from agorawebsdk-ng.

tsyrya avatar tsyrya commented on July 3, 2024

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.

yoreland avatar yoreland commented on July 3, 2024

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.

tsyrya avatar tsyrya commented on July 3, 2024

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.

tsyrya avatar tsyrya commented on July 3, 2024

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.

tsyrya avatar tsyrya commented on July 3, 2024

Could it because I do subscription with a delay, because before I subscribe there is a user rights checking logic?

from agorawebsdk-ng.

yoreland avatar yoreland commented on July 3, 2024

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.

tsyrya avatar tsyrya commented on July 3, 2024

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.

tsyrya avatar tsyrya commented on July 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.