livekit / client-sdk-js

LiveKit browser client SDK (javascript)
https://livekit.io
Apache License 2.0
335 stars 146 forks source link

await element to be attached before calling .play on it #1197

Closed pabra closed 1 month ago

pabra commented 1 month ago

otherwise Firefox 128 throws this error when 'setProcessor' is called on track:

failed to play processor element
Object { room: undefined, roomID: undefined, participant: undefined, pID: undefined, trackID: undefined, source: "camera", muted: false, enabled: true, kind: "video", streamID: "{bbe7a482-313d-49e6-8d55-5dbe42d2c24f}", … } enabled: true
error: DOMException: The fetching process for the media resource was aborted by the user agent at the user's request. kind: "video"
muted: false
pID: undefined
participant: undefined
room: undefined
roomID: undefined
source: "camera"
streamID: "{bbe7a482-313d-49e6-8d55-5dbe42d2c24f}" streamTrackID: "{ae53ec2f-9257-4f7e-9525-d7b2aa0ad809}" trackID: undefined
<prototype>: Object { … }

Unfortunately I'm not able to share code to reproduce this error. :/

changeset-bot[bot] commented 1 month ago

⚠️ No Changeset found

Latest commit: b2cf45a027767ac15d6da8fc4e5daab38e19b3b1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

CLAassistant commented 1 month ago

CLA assistant check
All committers have signed the CLA.

lukasIO commented 1 month ago

what problem does that error cause? Normally this is caused by another play request and shouldn't impact the functionality.

A reproduction of the issue would be important in order to follow up on this.

pabra commented 1 month ago

We have not noticed any impact in functionality. So far we just noticed the error in the logs and I tracked it down to this point.

lukasIO commented 1 month ago

got it. I think the issue here is simply that we're logging an error on play().catch eventhough it's not strictly true that it results in erroneous behaviour. The right fix might just be to log a warning instead of an error for this case or to log an error only for specific error types. Will close this PR.