I'm trying to use WebRTC to display a video input on-screen as a live feed. I'm not trying to do any peer-to-peer communications or anything like that, just display a video feed.
The code I have works fine for my laptops integrated webcam, but when I connect an external video input device (in this case an old camcorder connected via S-Video to a USB input using a StarTech converter - model number SVID2USB2NS) I get nothing. I've tried this in both Chrome and FireFox.
Both browsers find the video device and offers me the choice of my integrated webcam or the USB device (listed as "USB 2820" in this case), so they are aware of the device in this case.
In Chrome, when I try to connect, the "success" callback of the getUserMedia call is called, if I .getVideoTracks() I find the MediaStreamTrack
, and the moment of the callback, the MediaStreamTrack
returns enabled
= true
and readyState
= live
. However there's no video input (just a black video panel, and the little red "recording" icon in the Chrome browser tab doesn't appear). If I check the MediaStreamTrack a second later, I find that readyState
now = "ended
" (although enabled is still true).
In FireFox, again, the device is found, but any attempt to connect to it using getUserMedia just fires the error callback, with a HARDWARE_UNAVAILABLE error.
My getUserMedia
call is simply:
navigator.getUserMedia({ audio: false, video: true }, _webRTCsuccessCallback, _webRTCerrorCallback);
and my success callback is (including some test code to check the MediaStreamTrack
immediately and one second later):
function _webRTCsuccessCallback(stream) {
window.stream = stream; // stream available to console
if (window.URL) {
_video.src = window.URL.createObjectURL(stream);
} else {
_video.src = stream;
}
var tracks = stream.getVideoTracks();
if (tracks[0]) {
console.log(tracks[0]);
setTimeout(function () { console.log(tracks[0]); }, 1000);
}
}
(where _video is the html5 object on the page)
Firefox version 31.0
Chrome version 39.0.2171.71 m
OS version: Windows 7 Ultimate (6.1.7601) SP1
S-Video to USB converter: StarTech SVID2USB2NS (http://www.startech.com/AV/Converters/Video/USB-S-Video-Capture-Cable~SVID2USB2NS)
Source camera: Panasonic NV-DS35B (Digital Video Camera)
Does anyone have any ideas what's causing this, and why WebRTC won't play ball with this device?
(in more general terms, I know the device is sending a video signal to the PC, as in IE I have developed an ActiveX control that uses DirectShow to get the video feed, and it collects the feed just fine - different technology I appreciate, but it does give me evidence that the device is there and sending video!)