min-vid icon indicating copy to clipboard operation
min-vid copied to clipboard

Support any HTML5 video

Open jaredhirsch opened this issue 9 years ago • 11 comments

We have legal approval to support any video element if:

  • the page that hosts the video is loaded
  • preroll ads are shown in the player whenever present

Need to figure out the best way to clone a playing video element into the min vid panel. Maybe Document.importNode?

jaredhirsch avatar Sep 28 '16 13:09 jaredhirsch

We should try HTMLMediaElement.captureStream. Come to #media on mozilla's irc if you want to chat about it (same nick, Paris timezone).

This call allows forwarding an HTMLMediaElement to another one (using a MediaStream to connect the two), sharing all the resources behind the scene (decoders, frames, etc.). It's kind of standard (there is a spec, but we don't respect it to the letter), maybe you need a moz prefix.

In any case, this is awesome, and we (people doing media work in gecko) will be happy to talk if you need or want to know anything.

Links:

  • Doc: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/captureStream (don't trust the compat table, it's been in gecko for ever, prefixed)
  • Spec: https://w3c.github.io/html-media-capture/#widl-HTMLMediaElement-captureStream-MediaStream

padenot avatar Sep 28 '16 18:09 padenot

@padenot Sounds great! I'll ping you tomorrow. How late are you around in the evenings? Does 6pm Paris time work?

jaredhirsch avatar Sep 29 '16 00:09 jaredhirsch

Yep, should be alright.

padenot avatar Sep 29 '16 07:09 padenot

After looking over @padenot's comments in #media this morning to @6a68, I tried hacking together a version of this with the sdk. I assumed there would be some permissions issues, and there was.

Here is a list of steps describing what we want to achieve:

  • launch a pagemod (served from resource://) into a page with a tag
  • click a button on the page which will call captureStream returning a "mediasource" object
  • open a new window with our own tag and controls. (served from resource://)
  • set the tag in our new window's 'mozSrcObject' property to the "mediasource" object retrieved in the pagemod.
  • launch a pagemod (served from resource://) into a page with a tag

The main problem here is getting the mediastream object out of the page/pagemod and into the new window.

My next steps are digging into Components.utils.Sandbox and nsIPrincipal.

I hoping that we can change some permissions of our sandbox and allow this object to be passed from outside of the original url into the new window using something like SharedWorkerGlobalScope

I'll also mention that @padenot also mentioned taking a look at nsIAudioChannelAgent.idl but I'm not quite there yet.

meandavejustice avatar Sep 29 '16 20:09 meandavejustice

@paulrouget Hey, @padenot mentioned that you might have experience passing media streams across window boundaries. We're trying to send a video stream to a separate window (XUL or regular HTML window). Any suggestions on an approach that might work?

jaredhirsch avatar Sep 29 '16 20:09 jaredhirsch

I'm starting to think that passing a DOM element or reference may not be the best way to do this. If we can get access to the global store of MediaElement objects, maybe we can pass a reference into a second window. Need to figure out where that store is...

jaredhirsch avatar Sep 29 '16 20:09 jaredhirsch

Is development still ongoing?

If it will take much longer to implement this, how about a more straightforward implementation for plain HTML videos? Would seem to be an incremental win for user-facing features.

Caspy7 avatar Dec 18 '16 01:12 Caspy7

@paulrouget Hey, @padenot mentioned that you might have experience passing media streams across window boundaries. We're trying to send a video stream to a separate window (XUL or regular HTML window). Any suggestions on an approach that might work?

Sorry for the late reply. I indeed built a similar thing a while ago. iirc, i created a protocol handler that would create a video that would play the stream of another video. The stream was created via mozCaptureStream and transferred to the new window via as an URL. Something like URL.createObjectURL(video.mozCaptureStream());.

2 relevant links:

  • https://bugzilla.mozilla.org/show_bug.cgi?id=1177793
  • https://github.com/paulrouget/gecko-dev/commit/0e03ad567f5fb184ab97d381f1edc4e0b07871a1

paulrouget avatar Dec 20 '16 14:12 paulrouget

Hi whats the status of this? I'd love to add support into my HTML 5 player for this.

znap026 avatar May 15 '17 10:05 znap026

@znap026 Hey there, We currently support a wide range of html5 videos through the context menu option. We haven't come up with a way to apply the overlay icon to

meandavejustice avatar May 15 '17 17:05 meandavejustice

I'm watching videos from 34C3 [0], and have neither icon nor context menu. Same when I open the video directly. Could this be due to the videos being served over FTP (e.g., [1], from [2])?

[0] https://media.ccc.de/c/34c3 [1] https://ftp.fau.de/cdn.media.ccc.de//congress/2017/h264-hd/34c3-9027-eng-The_Work_of_Art_in_the_Age_of_Digital_Assassination.mp4 [2] https://media.ccc.de/v/34c3-9027-the_work_of_art_in_the_age_of_digital_assassination

shtrom avatar Jan 03 '18 02:01 shtrom