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 munications 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 ()
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!)
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 munications 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./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!)
Share Improve this question edited Nov 30, 2014 at 10:06 PulseLab asked Nov 27, 2014 at 15:42 PulseLabPulseLab 1,57911 silver badges15 bronze badges 9- 1 What camera and what OS? You may have to post a bug in the browser's corresponding bug trackers. – Benjamin Trent Commented Nov 29, 2014 at 18:56
- @BenjaminTrent thanks - edited my question to add the OS and camera info in. I feared it might end up with going to the browsers trackers, but as neither Chrome nor Firefox seems to want to know I just wondered if maybe it was something I was doing rather than a similar problem in both browsers, anyone more versant in WebRTC than me could offer up anything I missed! E.g. does webRTC in those browsers not like certain types of input, e.g. PAL maybe? – PulseLab Commented Nov 30, 2014 at 10:08
- 1 @PulseLab: Can you please confirm if you have the latest drivers installed for both StarTech SVID2USB2NS and Panasonic NV-DS35B ? – Qarib Haider Commented Dec 9, 2014 at 8:30
- Hi @SyedQarib, yes I do have the latest drivers for the StarTech device installed. The Panasonic camera doesn't have any drivers as such, it's just an S-Video out which connects through the StarTech device. Windows doesn't see what's on the other end of the StarTech device, as far as it's concerned, StarTech "is" the camera in question... – PulseLab Commented Dec 9, 2014 at 9:56
- 1 Did you try it with another WebRTC service such as opentokrtc./ok – taco Commented May 5, 2015 at 20:59
1 Answer
Reset to default 2The specs on Media Capture Streams state that during the life-cycle of a MediaStreamTrack the live state may be replaced by zero-information-content if the MST has either been "muted" or "disabled".This will result in rendering black frames.
In other words media can only flow from the source if the MST is both, unmuted and enabled.
The muted/unmuted state reflects if the source provides any media.
The enabled/disabled state determines whether the track outputs media.
Make sure that no other application is using your source device. In your case the StarTech converter. Close all other applications that might gain access to your capture device while you try to getUserMedia in the browser.
Visit this Working Draft for more information on MST life-cycle and flow.
Another problem may be that your device does not provide media that meets the constraints present on your media track. Your device is capable of delivering NTSC and PAL video signals. So try to adjust the constraints for getUserMedia e.g. for PAL signal like so:
{
audio: false,
video: {
mandatory: {
maxWidth: 768,
maxHeight: 576,
maxAspectRatio: 1.333,
maxFrameRate: 25
}
}
Hope that helps somehow.