Display audio and video on all sessions

This commit is contained in:
probablycorey
2013-07-25 15:55:30 -07:00
committed by Ben Ogle & Corey Johnson
parent 47ee4337ce
commit d49d3156eb
3 changed files with 17 additions and 14 deletions

View File

@@ -8,22 +8,21 @@ ParticipantView = require './participant-view'
module.exports =
activate: ->
hostView = null
loadedParticipants = {}
if atom.getLoadSettings().sessionId
session = atom.guestSession
for participant in session.getParticipants()
continue if participant.id == session.getId()
@createParticipant(session, participant)
else
session = new Session(site: window.site)
@handleEvents(session)
session.on 'participants-changed', (participants) =>
console.log 'participant', participants
for participant in participants
continue if participant.id == session.getId()
continue if participant.id of loadedParticipants
console.log 'adding', participant.id, participant
loadedParticipants[participant.id] = new ParticipantView(session, participant)
loadedParticipants[participant.id].attach()
session.on 'participant-entered', (participant) =>
@createParticipant(session, participant)
session.on 'participant-exited', (participant) =>
console.error "Someone left"
rootView.eachPane (pane) ->
setTimeout ->
@@ -31,6 +30,10 @@ module.exports =
buttons.insertAfter(pane.find('.git-branch'))
, 0
createParticipant: (session, participant) ->
view = new ParticipantView(session, participant)
view.attach()
handleEvents: (session) ->
copySessionId = ->
sessionId = session.getId()

View File

@@ -17,9 +17,6 @@ class HostStatusBar extends View
@session.on 'listening started stopped', @update
@update()
#@hostSession.waitForStream (stream) =>
# @video[0].src = URL.createObjectURL(stream)
update: =>
console.log 'updating', this
if @session.isListening()

View File

@@ -13,7 +13,7 @@ class Session
_.extend @prototype, require('event-emitter')
constructor: ({@site, @id, @host, @port}) ->
@host ?= 'ec2-54-218-196-152.us-west-2.compute.amazonaws.com'
@host ?= 'localhost'
@participants = []
@listening = false
@@ -78,7 +78,10 @@ class Session
createMediaConnection: ->
guest = @doc.get('collaborationState.guest')
host = @doc.get('collaborationState.host')
new MediaConnection(guest, host, isLeader: @isLeader())
if @isLeader()
new MediaConnection(guest, host, isLeader: true)
else
new MediaConnection(host, guest)
waitForStream: (callback) ->
@mediaConnection.waitForStream callback