Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Lolu chungechunge lwabekwa kunqolobane. Uyacelwa ubuze umbuzo omusha uma udinga usizo.

getUserMedia() video streams not appearing in Windows version

  • 3 uphendule
  • 4 zinale nkinga
  • 5 views
  • Igcine ukuphendulwa ngu factor3

more options

I am testing a basic video display using getUserMedia() in several Firefox browsers. I have a Version 31.0 browser running on a Macintosh, and another Wersion 31.0 browser running on Windows 7. A third v31.0 browser is running on Windows 8.1

The Javascript code being used is very simple:

/*
 * There are different methods used to get the media (camera and microphone)
 * depending on the browser used.This line selects the method to call based on
 * the browser.
 */
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia
                        || navigator.mozGetUserMedia;

/*
 * Set up desired constraints
 */
var constraints = { audio:false,video:true };
var video = document.querySelector("video");

/*
 * This function to be called upon successful media stream creation
 */
function madeStream(aStream) {
    window.stream = aStream;

    if(window.URL)
    {
        // For Chrome
        video.src = window.URL.createObjectURL(aStream);
    }
    else
    {
        video.src = aStream;
    }

    /*
     * At this point, we play the video!
     */
    video.play();
}

/*
 * This function is to be called should the attempt to create the stream fail.
 */
function failureWarning(theFail) {
    alert("Failed to get user media! "+theFail);
}

navigator.getUserMedia(constraints,madeStream,failureWarning);

The result of running this code using a basic HTML5 file (with a video tag: <video autoplay></video>) is as follows:

1. On the macintosh, I get a window requesting permission to use my video device. When I give permission, my camera is activated and I see local video, as desired.

2. On both Windows machines, I get a window requesting permission to use my video device, after I give permission, I get a blank screen. I know the video is being engaged, because my camera turns on. I have run both the macintosh and windows- based browsers using a Javascript debugger. The video is playing successfully on both machines.

Both machines are running the same version of Firefox, yet none of the Windows machines are displaying the video that is playing.

I am certain that this problem is some kind of configuration problem. Unless there is a bug in the Windows versions?

Someone please advise...

I am testing a basic video display using getUserMedia() in several Firefox browsers. I have a Version 31.0 browser running on a Macintosh, and another Wersion 31.0 browser running on Windows 7. A third v31.0 browser is running on Windows 8.1 <pre><nowiki>The Javascript code being used is very simple: /* * There are different methods used to get the media (camera and microphone) * depending on the browser used.This line selects the method to call based on * the browser. */ navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia; /* * Set up desired constraints */ var constraints = { audio:false,video:true }; var video = document.querySelector("video"); /* * This function to be called upon successful media stream creation */ function madeStream(aStream) { window.stream = aStream; if(window.URL) { // For Chrome video.src = window.URL.createObjectURL(aStream); } else { video.src = aStream; } /* * At this point, we play the video! */ video.play(); } /* * This function is to be called should the attempt to create the stream fail. */ function failureWarning(theFail) { alert("Failed to get user media! "+theFail); } navigator.getUserMedia(constraints,madeStream,failureWarning); </nowiki></pre> The result of running this code using a basic HTML5 file (with a video tag: &lt;video autoplay&gt;&lt;/video&gt;) is as follows: 1. On the macintosh, I get a window requesting permission to use my video device. When I give permission, my camera is activated and I see local video, as desired. 2. On both Windows machines, I get a window requesting permission to use my video device, after I give permission, I get a blank screen. I know the video is being engaged, because my camera turns on. I have run both the macintosh and windows- based browsers using a Javascript debugger. The video is playing successfully on both machines. Both machines are running the same version of Firefox, yet none of the Windows machines are displaying the video that is playing. I am certain that this problem is some kind of configuration problem. Unless there is a bug in the Windows versions? Someone please advise...

Okulungisiwe ngu cor-el

All Replies (3)

more options

There is a page on the Mozilla Developer Network about this function in Firefox. It can be found here.

Please note that Firefox does not support certain codes. The developers are working to increase code support, however, there are still some issues.


Viewing your example above, I see a blank flash object.

more options

Wesley:

The link you sent me to is just a description of getUserMedia(). I had already studied that page before entering my question here (I generally don't ask questions anywhere before researching a problem first).

There is nothing in the example that isn't already in the code I provided. In fact, the example looks almost exactly like my code, except for a certain useful check which I will soon incorporate into my code.

As for the "blank flash player":

Yes. It is somewhat weird that that shows up. . As you can see from the Javascript code I provided, there isn't any flash anything being used. This is what leads me to believe that there could be some configuration problem that I might need to fix on the Windows machines where it is appearing. Thank you for getting to the heart of my question/problem.

More information: I have a Windows laptop that is running Windows 8.0 which I tried the code on. Curiously, the video behaves as it should on that machine. Whatever this problem is it is not related to operating systems (like all the others, the version of Firefox is 31.0). Whatever this is, it must be some kind of configuration problem that is causing Firefox on some machines to access the wrong video(?).

Someone please advise.

Okulungisiwe ngu factor3

more options

I have an idea what the problem is.

The last helpful post gave me a clue. I started looking at the DOM handling of the Video tag. Apparently, on all machines it comes up as a Flash object, but as the code indicates the source object is supposed to change once the MediaStream is successfully created.

Apparently, on some of my installations when video.src changes the display dynamically changes to the MediaStream object and the video gets displayed.

On those installations where it is blank, apparently the DOM object changes but the display for some reason does not update to show it.

That seems to be the problem. I do not know why this happens. If I can find out why I believe there is a solution.

Does anyone have any idea why this is happening on some installations and not others?

Please advise.