Anton Shestakov <av6@dwimlabs.net>, Thu, 07 Jul 2016 00:12:35 +0800
provision: update tasks to use more YAMLy syntax
js/calls.js
Permissions: -rw-r--r--
// Generated by CoffeeScript 1.10.0 var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Tram.Call = (function(superClass) { extend(Call, superClass); return Call.__super__.constructor.apply(this, arguments); Call.prototype.idAttribute = 'jid'; Call.prototype.initialize = function() { this.on('change:local/stream', this.updateLocalStreamURL); return this.on('change:remote/stream', this.updateRemoteStreamURL); Call.prototype.updateStreamURL = function(sattr, uattr) { URL.revokeObjectURL(this.get(uattr)); stream = this.get(sattr); return this.set(uattr, URL.createObjectURL(stream)); return this.unset(uattr); Call.prototype.updateLocalStreamURL = function() { return this.updateStreamURL('local/stream', 'local/stream/url'); Call.prototype.updateRemoteStreamURL = function() { return this.updateStreamURL('remote/stream', 'remote/stream/url'); Tram.Calls = (function(superClass) { extend(Calls, superClass); return Calls.__super__.constructor.apply(this, arguments); Calls.prototype.model = Tram.Call; Tram.CallView = (function(superClass) { extend(CallView, superClass); return CallView.__super__.constructor.apply(this, arguments); CallView.prototype.templateEl = $($('#video-block-template').html()); CallView.prototype.events = { 'click [data-mute-cam]': function() { return this.model.set('local/video/muted', true); 'click [data-unmute-cam]': function() { return this.model.set('local/video/muted', false); 'click [data-mute-mic]': function() { return this.model.set('local/audio/muted', true); 'click [data-unmute-mic]': function() { return this.model.set('local/audio/muted', false); 'click [data-mute-audio]': function() { return this.model.set('remote/audio/muted', true); 'click [data-unmute-audio]': function() { return this.model.set('remote/audio/muted', false); CallView.prototype.initialize = function() { this.setElement(this.templateEl.clone()); this.$local = this.$('video.local'); this.$remote = this.$('video.remote'); CallView.prototype.bind = function() { this.listenTo(this.model, 'change:local/stream/url', this.updateLocal); this.listenTo(this.model, 'change:remote/stream/url', this.updateRemote); this.listenTo(this.model, 'change:local/video/muted', this.muteCam); this.listenTo(this.model, 'change:local/audio/muted', this.muteMic); this.listenTo(this.model, 'change:remote/audio/muted', this.muteAudio); return this.listenTo(this.model, 'remove', this.remove); CallView.prototype.updateLocal = function() { if (this.model.has('local/stream/url')) { return this.updateVideo(this.$local, this.model.get('local/stream/url')); return this.removeVideo(this.$local); CallView.prototype.updateRemote = function() { if (this.model.has('remote/stream/url')) { return this.updateVideo(this.$remote, this.model.get('remote/stream/url')); return this.removeVideo(this.$remote); CallView.prototype.updateVideo = function($video, url) { return $video.each(function() { CallView.prototype.removeVideo = function($video) { return $video.each(function() { return this.removeAttribute('src'); CallView.prototype.enableTracks = function(tracks, state) { var i, len, results, track; for (i = 0, len = tracks.length; i < len; i++) { results.push(track.enabled = state); CallView.prototype.muteCam = function() { muted = this.model.get('local/video/muted'); return this.enableTracks((ref = this.model.get('local/stream')) != null ? typeof ref.getVideoTracks === "function" ? ref.getVideoTracks() : void 0 : void 0, !muted); CallView.prototype.muteMic = function() { muted = this.model.get('local/audio/muted'); return this.enableTracks((ref = this.model.get('local/stream')) != null ? typeof ref.getAudioTracks === "function" ? ref.getAudioTracks() : void 0 : void 0, !muted); CallView.prototype.muteAudio = function() { muted = this.model.get('remote/audio/muted'); return this.enableTracks((ref = this.model.get('remote/stream')) != null ? typeof ref.getAudioTracks === "function" ? ref.getAudioTracks() : void 0 : void 0, !muted); CallView.prototype.render = function() { this.rivet = rivets.bind(this.el, { CallView.prototype.remove = function() { return CallView.__super__.remove.apply(this, arguments); Tram.CallsApp = (function(superClass) { extend(CallsApp, superClass); return CallsApp.__super__.constructor.apply(this, arguments); CallsApp.prototype.initialize = function() { return this.listenTo(this.collection, 'add', this.onAdd); CallsApp.prototype.onAdd = function(model) { model.view = new Tram.CallView({ return this.$el.append(model.view.render().el); //# sourceMappingURL=calls.js.map