steep-balloon-41261
12/12/2022, 10:38 AMbest-parrot-43500
12/12/2022, 10:59 AMRoom.connect()
or much rather Room.acquireAudioContext()
There const ctx = getNewAudioContext();
should be wrapped in a try/catch and the audioEnabled flag should be set to false and trigger the RoomEvent.AudioPlaybackStatusChanged event.
It is a bit strange though that still the video playback doesn’t start and the
TrackEvent.AudioPlaybackFailed
Isn’t triggered though when trying to play back the videobest-parrot-43500
12/12/2022, 11:22 AMsuspended status. --> This means that Room.acquireAudioContext() should likely both have a try/catch AND check for the status to be running.
I’ll debug the play() of the actual video now to see why we don’t get a promise rejection there.polite-kilobyte-67570
12/12/2022, 11:32 AMacquireAudioContext and emit the AudioPlaybackStatusChanged event if it failed to start (and was true before).
2. Regarding the video playback, that’s even stranger. video elements with muted attribute set, should always be allowed to autoplay. Are you using the client-sdk attach call ? Are you seeing this behaviour across different browsers?best-parrot-43500
12/12/2022, 12:02 PMbest-parrot-43500
12/12/2022, 12:04 PMAre you using the client-sdkYescall ?attach
Are you seeing this behaviour across different browsers?I’m not having it on my OSX Chrome but (not even the warning message) but I have it on a Windows PC Chrome and on the OSX of 2 colleagues on Chrome I’ll debug it on the Windows PC and report back
best-parrot-43500
12/12/2022, 12:13 PMvideo element and I think I found the problem.
You only ever explicitly call the play() method when you are either attaching it to an audio element or if you are using a Firefox or Safari browser (Track.attach() and Track.attachToElement())
As far as I can see for a normal Chrome you’d simply set autoplay to true but I can’t see you calling muted=true anywhere.
I have had the same issue in the past when we where managing this ourselves.best-parrot-43500
12/12/2022, 12:17 PMautoplay=false
2. set the muted flag to true if we don’t have any audio track, otherwise keep it false
3. always call play()
4. if play() fails, do muted=true and call play() again
5. Display a button that displays a speaker symbol, on click change muted=falsepolite-kilobyte-67570
12/12/2022, 12:17 PMmedia interaction index for each url, might be related: https://developer.chrome.com/blog/autoplay/
I think if the audio playback requires interaction we would get the autoplay for video for free.best-parrot-43500
12/12/2022, 12:18 PMmuted=false and you’re not allowed to play audiopolite-kilobyte-67570
12/12/2022, 12:18 PMbest-parrot-43500
12/12/2022, 12:18 PMbest-parrot-43500
12/12/2022, 12:19 PMautoplay=false and call it yourself so you know it failedbest-parrot-43500
12/12/2022, 12:19 PMaha! yeah, we would generally recommend to use separate media elements for audio and video tracks! any particular reason why you want to attach both to the same element?Just because it’s easier to manage on our end that way, and I thought, why manage a separate audio element if I can do both in one… 🤷
best-parrot-43500
12/12/2022, 12:21 PMpolite-kilobyte-67570
12/12/2022, 12:21 PMbest-parrot-43500
12/12/2022, 12:22 PMpolite-kilobyte-67570
12/12/2022, 12:24 PMpolite-kilobyte-67570
12/12/2022, 12:25 PMbest-parrot-43500
12/12/2022, 12:27 PMaudio element and attach the mic track to it instead of the video element.
Now here’s the interesting thing: I do get the expected RoomEvent.AudioPlaybackStatusChanged now and ``room.canPlayAudio=false`` BUT my video’s still don’t playbest-parrot-43500
12/12/2022, 12:28 PMpolite-kilobyte-67570
12/12/2022, 12:30 PMvideoEl.play in the TrackSubscribed callback, does that fix things?best-parrot-43500
12/12/2022, 12:34 PM$0.play() it solves the issue, yes.best-parrot-43500
12/12/2022, 12:35 PMmuted=true autoplay will not start if you haven’t had a user interaction on the pagebest-parrot-43500
12/12/2022, 12:35 PMbest-parrot-43500
12/12/2022, 12:37 PMvideo element, set it to muted=true and then pass it into the attach() method it workspolite-kilobyte-67570
12/12/2022, 12:40 PMattach method also sets the muted attribute on the element 🤔best-parrot-43500
12/12/2022, 12:40 PMbest-parrot-43500
12/12/2022, 12:42 PMhuh, ourLooking at yourmethod also sets the muted attribute on the elementattach
Track class I can’t find where you are doing the muted=true though all I see is this:best-parrot-43500
12/12/2022, 12:46 PMRemoteAudioTrack.attach but in this case we’re talking about the RemoteVideoTrack.attachpolite-kilobyte-67570
12/12/2022, 2:18 PMattachToElement function, but muted is currently not part of it.
It does get trickier to think about it if users would want to use the same element for both video and audio. In this case setting muted would be undesired.best-parrot-43500
12/12/2022, 2:26 PMbest-parrot-43500
12/12/2022, 2:27 PMpolite-kilobyte-67570
12/12/2022, 2:27 PMmuted=true and autoplay=true not work for you? do you have to call play manually?best-parrot-43500
12/12/2022, 2:28 PMbest-parrot-43500
12/12/2022, 2:28 PMthanks, does the combination ofYes it does but if you want to be able to detect if playback worked or not you need to explicitly callandmuted=truenot work for you?autoplay=true
play()best-parrot-43500
12/12/2022, 2:29 PMbest-parrot-43500
12/12/2022, 2:30 PMmuted=false try play and if it doesn’t work mute=true and play againpolite-kilobyte-67570
12/12/2022, 2:32 PMpolite-kilobyte-67570
12/12/2022, 2:32 PMbest-parrot-43500
12/12/2022, 2:35 PMin case you have audio and video tracks combined on the same element, your step 4. would then only play the video, I assume?Yes and then it would emit the
RoomEvent.AudioPlaybackStatusChanged eventbest-parrot-43500
12/12/2022, 2:36 PMroom.startAudio() methodpolite-kilobyte-67570
12/12/2022, 2:48 PMbest-parrot-43500
12/12/2022, 3:03 PM