Example #1
0
Camera.prototype.stoppedRecording = function(recorded) {
  debug('stopped recording');
  this.stopVideoTimer();
  if (!recorded) {
    this.set('recording', 'error');
  }
  this.set('recording', 'stopped');

  // Unlock orientation when stopping video recording.
  // REVIEW:WP This logic is out of scope of the
  // Camera hardware. Only the App should be
  // making such high level decicions.
  this.orientation.start();

  var self = this;
  var video;

  if (recorded) {
    video = mix({}, this.video);
    video.poster = mix({}, video.poster);

    // Re-fetch the blobs from storage
    this.storage.video.get(video.filepath).then(function(blob) {
      video.blob = blob;
      // Tell the app the new video is ready
      self.emit('newvideo', video);
      self.ready();
    }, function() {
      if (self) {
        self.onStopRecordingError(video);
        self = null;
      }
    });
  }
};
Example #2
0
Camera.prototype.formatCapabilities = function(capabilities) {
  capabilities = mixin({}, capabilities);
  return mixin(capabilities, {
    pictureSizes: this.formatPictureSizes(capabilities.pictureSizes),
    pictureFlashModes: capabilities.flashModes,
    videoFlashModes: capabilities.flashModes
  });
};
Example #3
0
  display: function(options) {
    var item = mix({}, options);
    var id = ++this.counter;
    var self = this;

    item.el = document.createElement('li');
    item.el.className = options.className || '';
    item.el.innerHTML = '<span>' + options.text + '</span>';
    this.el.appendChild(item.el);

    // Remove last temporary
    // notification in the way
    this.clear(this.temporary);

    // Remove non-persistent
    // messages after 3s
    if (!item.persistent) {
      this.temporary = id;
      this.hide(this.persistent);
      item.clearTimeout = setTimeout(function() {
        self.clear(id);
      }, this.time);
    }

    // Remove previous persistent
    if (item.persistent) {
      this.clear(this.persistent);
      this.persistent = id;
    }

    // Store and return
    this.hash[id] = item;
    return id;
  },
Example #4
0
  View.extend = function(props) {
    var Parent = this;

    // The extended constructor
    // calls the parent constructor
    var Child = function() {
      Parent.apply(this, arguments);
    };

    Child.prototype = Object.create(Parent.prototype);
    Child.extend = View.extend;
    mixin(Child.prototype, props);

    return Child;
  };
Example #5
0
  display: function(options) {
    var item = mix({}, options);
    var id = ++this.counter;
    var self = this;

    item.el = document.createElement('li');
    item.el.className = options.className || '';

    var span = document.createElement('span');
    if (typeof(options.text) === 'string') {
      span.setAttribute('data-l10n-id', options.text);
    } else {
      if (options.text.html) {
        span.innerHTML = options.text.html;
      }
    }
    item.el.appendChild(span);
    if (options.attrs) { this.setAttributes(item.el, options.attrs); }
    // Notification should have the semantics of the status ARIA live region.
    item.el.setAttribute('role', 'status');
    // Making notfication assertive, so it is spoken right away and not queued.
    item.el.setAttribute('aria-live', 'assertive');
    this.el.appendChild(item.el);

    // Remove last temporary
    // notification in the way
    this.clear(this.temporary);

    // Remove non-persistent
    // messages after 3s
    if (!item.persistent) {
      this.temporary = id;
      this.hide(this.persistent);
      item.clearTimeout = setTimeout(function() {
        self.clear(id);
      }, this.time);
    }

    // Remove previous persistent
    if (item.persistent) {
      this.clear(this.persistent);
      this.persistent = id;
    }

    // Store and return
    this.hash[id] = item;
    return id;
  },
Example #6
0
Camera.prototype.stoppedRecording = function(recorded) {
  debug('stopped recording');
  this.stopVideoTimer();
  this.stopRecordPending = false;
  this.set('recording', false);

  // Unlock orientation when stopping video recording.
  // REVIEW:WP This logic is out of scope of the
  // Camera hardware. Only the App should be
  // making such high level decicions.
  this.orientation.start();

  var self = this;
  var videoReq;
  var posterReq;
  var video;

  if (recorded) {
    video = mix({}, this.video);

    // Re-fetch the blobs from storage
    videoReq = this.storage.video.get(video.filepath);
    posterReq = this.storage.picture.get(video.poster.filepath);

    Promise.all([videoReq.then(), posterReq.then()]).then(function() {
      video.blob = videoReq.result;
      video.poster.blob = posterReq.result;
      // Tell the app the new video is ready
      self.emit('newvideo', video);
      self.ready();
    }, function() {
      if (self) {
        self.onStopRecordingError(video);
        self = null;
      }
    });
  }
};
Example #7
0
Camera.prototype.formatCapabilities = function(capabilities) {
  var hasHDR = capabilities.sceneModes.indexOf('hdr') > -1;
  var hdr = hasHDR ? ['on', 'off'] : undefined;
  return mix({ hdr: hdr }, capabilities);
};
Example #8
0
import mixin from 'lib/mixin'
import Textarea from './Textarea'
import Markdown from './Markdown'

class TextareaMarkdown extends Textarea { }
mixin(TextareaMarkdown, Markdown)

export default TextareaMarkdown