Skip to content

Using non-default camera with createVideo(CAPTURE) #1043

@shiffman

Description

@shiffman

The need to use a different camera with createVideo(CAPTURE) has come up several times this semester. @lmccart posted an example for how to do so here:

https://github.com/ITPNYU/ICM-2015/blob/master/09_video_sound/02_capture/13_get_sources/sketch.js

I'm wondering if we should wrap this functionality and possibly make it more generic to sync with p5.sound and p5.AudioIn?

Something like:

var capture;
var sourceId = '_________';

function setup() {

  // can be removed once sourceId is discovered
  // or creating the capture could be moved to callback?
  captureList(gotSources);
  capture = createVideo(CAPTURE, sourceId);

}

// This method can be removed after the source ID has been determined.
// Make this only give the "video" kind for captureList?
function gotList(sources) {
  console.log('video: '+sources[i].label+' ID: '+sources[i].id);
}

This would add one function to the API (captureList(). I'm happy to work on this if we think it's a good idea.

Another idea would be to add a callback to createVideo where the user could somehow assign the sourceId dynamically?

  capture = createVideo(CAPTURE, gotSources);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions