Skip to content

Instantly share code, notes, and snippets.

@BitOfUniverse
Created May 23, 2016 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BitOfUniverse/9dc448df58efcfc95c2fd7f80b488da0 to your computer and use it in GitHub Desktop.
Save BitOfUniverse/9dc448df58efcfc95c2fd7f80b488da0 to your computer and use it in GitHub Desktop.
$ ->
if $('#stream').length
# Initialize an OpenTok Session object
session = TB.initSession(gon.opentok.sessionId);
videoOptions = {width: 640, height: 480}
# Attach event handlers
session.on
streamCreated: (event)->
# Subscribe to the stream that caused this event, put it inside the container we just made
session.subscribe(event.stream, $('#stream')[0], videoOptions);
# Connect to the Session using the 'apiKey' of the application and a 'token' for permission
session.connect(gon.opentok.apiKey, gon.opentok.token);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment