twilio / twilio-video.js

Twilio’s Programmable Video JavaScript SDK
https://www.twilio.com/docs/video/javascript
Other
571 stars 217 forks source link

<video> tag does not have src attribute after conversation.localMedia.attach() [Firefox Only] #14

Closed VinayNadig closed 8 years ago

VinayNadig commented 8 years ago

Firefox Version - 47.0

Twilio Conversations Version: 0.13.7

Steps to Replicate:

  1. Clone Javascript Quickstart from https://github.com/twilio/video-quickstart-javascript
  2. Generate an access token from https://www.twilio.com/console/video/dev-tools/testing-tools
  3. Set access token in quickstart.js
  4. Run start-server_server.sh
  5. Open localhost:8000/quickstart.html(or whichever port the server is running on) in Firefox.
  6. Click on 'Preview my Camera'
  7. Allow access to camera and microphone.
  8. Inspect the preview window in the firefox developer console.

The video tag within the div#local-media element does not have any attribute associated with it.

Expected behavior would be to have a src attribute or a source tag as a child.

We are trying to display the video feed on fullscreen(in addition to his preview) when a user clicks on his local media preview. On chrome, we do this by parsing the src attribute of the video tag and creating a new video tag and setting the src attribute on it. This fails on Firefox since the video tag does not have a src attribute.

So, the question is, how do we get the video feed url on Firefox after previewMedia.attach('#local-media');?

Relevant code: https://github.com/twilio/video-quickstart-javascript/blob/master/quickstart.js#L92

VinayNadig commented 8 years ago

Okay, finally managed to clone the video feed to a separate video element. For anyone facing the same issue, here are the steps:

var video = $('<video>')[0]
video.mozSrcObject = video.srcObject = $("#existing-video-element")[0].mozSrcObject
$("#video-fullscreen").html(video)

I am still not sure if an empty video tag without src attribute is the expected behavior on Firefox.

Feel free to close the issue if it's the expected behavior.

markandrus commented 8 years ago

Hi @VinayNadig,

I was just about to answer your question, but I see you figured it out yourself!

I am still not sure if an empty video tag without src attribute is the expected behavior on Firefox.

Yes, in Firefox they use the srcObject attribute instead of src (actually, they prefix it as mozSrcObject), so this is expected. Eventually, I think Chrome will move to srcObject (at least that is what's in the specs).