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

<a-image> keeps running videos after changing src #3615

Open
greggman opened this issue Jun 3, 2018 · 5 comments
Open

<a-image> keeps running videos after changing src #3615

greggman opened this issue Jun 3, 2018 · 5 comments

Comments

@greggman
Copy link
Contributor

greggman commented Jun 3, 2018

setting the src to an <a-image> at runtime to a video and then later to an image the image is loaded but the video keeps playing in the background

@gftruj
Copy link
Contributor

gftruj commented Aug 17, 2018

Hi i tried experimenting with this:
as a result i got a branch which:

The video elements are created and cached in src/system/material.js
i couldn't grab the reference to whats the source when its being changed - so i've kept them in the shader component + added the necessary logic (pause when changing sources, reload when re-using a cached video).

Should i make it into a PR, or wait for some feedback regarding the branch ?

@machenmusik
Copy link
Contributor

My two cents:

If you mean using a video by selector reference, you have to stop the video yourself, when you change the src, a-image should stop using it but does not manipulate it (since it doesn't really own it)

If you mean by src, then since a video element is created to use it, really a-image should stop and discard the video when src changed (assuming there is no other reference to it) which it probably doesn't (and I would consider a bug)

@gftruj
Copy link
Contributor

gftruj commented Aug 22, 2018

@machenmusik here its the second case, where the <a-entity> creates the <video> element as i mentioned (here). After its creation the reference is being passed to a callback, but the callback function doesn't use it at all.

@pdbeard
Copy link

pdbeard commented Feb 8, 2022

The main repo still has this issue. @gftruj ( Hi from years and years in the future) any chance you still have a branch with a working fix? The link is now dead and the fiddles have the same issue when using the most recent aframe version.

@gftruj
Copy link
Contributor

gftruj commented Feb 10, 2022

@pdbeard I have no clue what happened to the branch, and I'm afraid I'm a bit too busy to re-create it, but I can offer a workaround, which should be working properly if you wait for a video to load before switching (because even if an old one is cached, the new one will be created and play in the background ).

You could also load the videos in threejs, omitting the material system at all.

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

4 participants