Initial video play promise rejects in Chrome

When loading a scene with a video texture, a promise is rejected in Chrome due to their policy on autoplay (autoplay is false). From what I can tell the play request is to get the first frame of the video and apply it to the texture.

The scene being loaded is from a link. When the link is clicked from a page on the same domain, the video loads as normal, but when the link is pasted to a new tab the promise is rejected.
I have tried making the video muted by default (Chrome’s policy allows for muted autoplay), but it looks as though the play promise is part of the videotexture constructor.

I noticed that the onUserActionRequestedObservable is offered as a workaround. At what point is this to be called in order to prevent this?

Updating _createInternalTexture to set the video as muted before var playing =, and then unmuting when the video is paused within this function prevents the promise rejection.

I will look into it but it sounds like a good idea.

I pushed the fix, It will be in the next version,

1 Like