Anton Shestakov <av6@dwimlabs.net>, Sat, 14 Jul 2018 23:50:05 +0800
calls: use srcObject instead of URL.createObjectURL() and revokeObjectURL()
Not sure about srcObject = null, needs to be tested.
coffee/calls.coffee
Permissions: -rw-r--r--
class Tram.Call extends Backbone.Model class Tram.Calls extends Backbone.Collection class Tram.CallView extends Backbone.View templateEl: $($('#video-block-template').html()) 'click [data-mute-cam]': -> @model.set('local/video/muted', true) 'click [data-unmute-cam]': -> @model.set('local/video/muted', false) 'click [data-mute-mic]': -> @model.set('local/audio/muted', true) 'click [data-unmute-mic]': -> @model.set('local/audio/muted', false) 'click [data-mute-audio]': -> @model.set('remote/audio/muted', true) 'click [data-unmute-audio]': -> @model.set('remote/audio/muted', false) 'click [data-hang-up]': -> @model.get('contact').trigger('action/hangup') @setElement(@templateEl.clone()) @$local = @$('video.local') @$remote = @$('video.remote') @$avatarColumn = @$('.avatar-column') @listenTo(@model, 'change:local/stream', @updateLocal) @listenTo(@model, 'change:remote/stream', @updateRemote) @listenTo(@model, 'change:local/video/muted', @muteCam) @listenTo(@model, 'change:local/audio/muted', @muteMic) @listenTo(@model, 'change:remote/audio/muted', @muteAudio) @listenTo(@model, 'remove', @remove) if @model.has('local/stream') @updateVideo(@$local, @model.get('local/stream')) if @model.has('remote/stream') @updateVideo(@$remote, @model.get('remote/stream')) updateVideo: ($video, stream) -> toggleTracks: (tracks, state) -> muted = @model.get('local/video/muted') @toggleTracks(@model.get('local/stream')?.getVideoTracks?(), not muted) muted = @model.get('local/audio/muted') @toggleTracks(@model.get('local/stream')?.getAudioTracks?(), not muted) muted = @model.get('remote/audio/muted') @toggleTracks(@model.get('remote/stream')?.getAudioTracks?(), not muted) @rivet = rivets.bind(@el, call: @model, view: @) @av = new Tram.AvatarView(model: @model.get('contact')) @$avatarColumn.append(@av.render().el) class Tram.CallsApp extends Backbone.View @listenTo(@collection, 'add', @onAdd) model.view = new Tram.CallView(model: model) @$el.append(model.view.render().el)