Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow setting which device/media source to use. #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

allow setting which device/media source to use. #31

wants to merge 2 commits into from

Conversation

nylki
Copy link

@nylki nylki commented Jun 10, 2015

This is useful for mobile devices where there might not be a chooser for multiple devices, but the first best is used (chrome, as of writing this commit message).

To init the element you would do something like this in your client code:

var videoSources;
if (videoSources === undefined) {
        if (MediaStreamTrack.getSources !== undefined) {
            MediaStreamTrack.getSources(function(sources) {


                console.log("all possible media sources --->");
                for (var i = 0; i < sources.length; i++) {
                    console.log(sources[i].id + " is " + sources[i].kind);
                    if(sources[i].kind === "video") videoSources.push(sources[i]);
                }
            });
        }
    }

    $scope.myChannel = {
        // the fields below are all optional
        videoHeight: 800,
        videoWidth: 600,
        video: null, // Will reference the video element on success
        source: videoSources[1]
    };

notice the: source: videoSources[1] in the configuration.

…bile devices where there might not be a chooser for multiple devices, but the first best is used (chrome, as of writing this commit message)
@jonashartmann
Copy link
Owner

Hi @nylki ! Thank you very much for your contribution.
But as you can see, the Travis CI build is failing for this PR. It is mainly because of the code style, since JSHint is warning about some errors. You can see them here.
Could you also update the unit tests for this feature that you are adding?

I will be happy to accept your changes as soon as the build is passing.

@nylki
Copy link
Author

nylki commented Jun 11, 2015

@jonashartmann I made the code style changes.
I would be happy to add tests for the feature. However I have never done unit tests (via jasmine) for javascript code yet. If you could give me some pointers it, it would be great :)

@jonashartmann
Copy link
Owner

@nylki here are some pointers ☺

  • verify you can run the current tests with "grunt test" and they pass
  • read about jasmine in the Web. Some links below
    You might also want to read about Karma
  • update the webcamSpec.js file under the tests folder
  • make sure it stills works
  • commit and push
  • verify that the Travis build worked
  • let me know
  • enjoy 🎉

http://mobile.htmlgoodies.com/beyond/javascript/testing-javascript-using-the-jasmine-framework.html
http://jasmine.github.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants