   onRealTimePlaybackEnded: (e) ->
     @$el.removeClass 'real-time'
     @onWindowResize()
+    @onRealTimeMultiplayerPlaybackEnded()
 
   destroy: ->
     @levelLoader?.destroy()

      return
    players = new RealTimeCollection('multiplayer_level_sessions/' + @multiplayerSession.id + '/players')
    myPlayer = opponentPlayer = null
    for i in [0...players.length]
      player = players.at(i)
      if player.get('id') is me.id
        myPlayer = player
      else
        opponentPlayer = player


  # Real-time Multiplayer ######################################################

  onRealTimeMultiplayerPlaybackEnded: ->
    if @multiplayerSession
      players = new RealTimeCollection('multiplayer_level_sessions/' + @multiplayerSession.id + '/players')
      players.each (player) -> player.set 'state', 'coding' if player.id is me.id

  onJoinedRealTimeMultiplayerGame: (e) ->
    @multiplayerSession = e.session

