
bower install --save flight-user-mediauserMedia.attachTo('video', {
video: true,
audio: false
});define(function (require) {
'use strict';
var defineComponent = require('flight/lib/component');
return defineComponent(myComponent);
this.fallback = function (ev) {
useFlashWebcam();
};
this.triggerPause = function (ev) {
this.trigger('ui-user-media-needs-pause');
};
this.triggerSnapshot = function (ev) {
this.trigger('ui-user-media-needs-snapshot');
};
this.switchToPauseState = function (ev) {
console.log('I am in pause state');
}
function myComponent() {
this.after('initialize', function () {
this.on('click', this.triggerPlay);
this.on(this.attr.snapshotTriggerSelector, 'click', this.triggerSnapshot);
this.on('user-media-not-supported', this.fallback);
this.on(document, 'user-media-pause', this.switchToPauseState);
this.on(document, 'user-media-snapshot-taken', this.displaySnapshot);
});
}For each of the native event a user-media-NATIVE_EVENT will be triggered
To interact with it you can trigger the ui-user-media-needs-NATIVE_EVENT events, ui-user-media-needs-play, ui-user-media-needs-pause, etc.
Yo request an snapshot simply trigger ui-user-media-needs-snapshot and lisent to user-media-snapshot-taken which will have a { src: 'path/to/file'} in the event data.
Development of this component requires Bower, and preferably Karma to be globally installed:
npm install -g bower karmaThen install the Node.js and client-side dependencies by running the following commands in the repo's root directory.
npm install
bower installTo continuously run the tests in Chrome and Firefox during development, just run:
karma startAnyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.