Skip to content
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

Audio MediaStreamTrack.enabled always true #212

Open
putrafajarh opened this issue Jul 10, 2021 · 0 comments
Open

Audio MediaStreamTrack.enabled always true #212

putrafajarh opened this issue Jul 10, 2021 · 0 comments

Comments

@putrafajarh
Copy link

putrafajarh commented Jul 10, 2021

Your environment.

  • Version: 1.7.2
  • Browser: chrome
  • Other Information - stacktraces, related issues, suggestions how to fix, links for us to have context

What did you do?

I want to create button to toggle audio off on,
i need current status audio to show icon related to current status

isMuted(kind) {
    try {
        if (kind === 'audio') {
            const tracks = this.localStream.getAudioTracks()
            tracks.forEach(track => {
                console.log('track: ', track)
            })
            // return this.localStream.getAudioTracks()[0].enabled
            return tracks[0].enabled
        }
        if (kind === 'video') {
            return this.localStream.getVideoTracks()[0].enabled
        }
        throw new Error('track kind is required')
    } catch (error) {
        console.error(error);
    }
},
console.log('audio muted', this.isMuted('audio'))
this.localStream.mute('audio')
console.log('audio muted', this.isMuted('audio'))

client.publish(this.localStream)

this.localStream.unmute('audio')
console.log('audio muted', this.isMuted('audio'))

this.localStream.mute('audio')
console.log('audio muted', this.isMuted('audio'))

What did you expect?

MediaStreamTrack.enabled is false after localStream.mute('audio')
MediaStreamTrack.enabled is true after localStream.unmute('audio')

What happened?

MediaStreamTrack.enabled always true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant