MozillaReality / mred

INACTIVE - Mixed Reality Editor
27 stars 6 forks source link

expand media control methods #110

Closed blairmacintyre closed 3 months ago

blairmacintyre commented 5 years ago

right now we have play() and stop(). We should define clearly if play() starts from the beginning or from where it was last paused. Does stop() also rewind?

need:

Also, in this overview (https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Video_and_audio_APIs) there are some events we should be listening to.

blairmacintyre commented 5 years ago

For now, I will update things so stop just stops (no automatic rewind), and the video always loops.

blairmacintyre commented 5 years ago

@joshmarinacci asked:

Should we really create our own wrapper api or would it be better to expose the real Audio and Video objects from the HTML spec?

I think we should do a bit of both. Dealing with all the crap shown in that overview URL is too much for someone using this tool, so we will need to do some. And whatever API we expose, we can alos use part of it for other "time based media" (animated 3D models, 2D flipbooks, gifs).

We have a bit of a mishmash right now, anyway: you can getMediaAsset and that gives a facade you can play/stop, or you can call play stop on the object itself. I think we should consider getting rid of the current playMediaAsset/stopMediaAsset, and flesh out the thing returned buy GetMediaAsset.

Then, whatever asset it is (image including gif, video, audio, 3D model), we can provide some common simple methods. But, we can also return the "native asset" (video or audio tags) if there is one.

Most of these methods will be pretty easy, but having them the same for multiple types will make it easy. For example, treating video and gifs the same; being able to start an animation the same as starting a video, getting the length of an audio, video, gif or whatever the "current" animation of a model is. Saying "loop".