samdutton / simpl

Simplest possible examples of HTML, CSS and Javascript:
https://simpl.info
Apache License 2.0
5.18k stars 1.64k forks source link

MediaStreamTrack.getSources on Android Chrome #47

Closed agranig closed 10 years ago

agranig commented 10 years ago

Hi,

Although getusermedia/sources/js/main.js detects two cameras on my Android phone (Nexus4 with kitkat), the second camera stream stays black when switching. Both cameras are working, so I see the stream of camera1 if I select that one first, but when switching to camera2 afterwards, then camera2 stays black. Same vice versa. I see the stream of camera2 if I select that one first, but when switching to camera1 afterwards, then camera1 stays black. Pretty weird.

Not sure if it's an Android issue, or if you need specific code to properly switch cameras on Android on the fly?

Works flawlessly on the Desktop though.

Andreas

agranig commented 10 years ago

Figured it out. You need to stop the previous stream before calling getUserMedia() on the new camera.