-
-
Save BitOfUniverse/10acf4aaaacdbc851c8fb59b51479bdc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UsersController < ApplicationController | |
before_action :authenticate_user! | |
def stream | |
@stream = current_user.stream || current_user.create_stream | |
gon.opentok = opentok_data(@stream) | |
end | |
def watch | |
@stream = User.find(params[:id]).stream | |
gon.opentok = opentok_data(@stream) | |
end | |
private | |
def opentok_data(stream) | |
token = OpenTokClient.generate_token(stream.opentok_session_id) | |
{ sessionId: stream.opentok_session_id, apiKey: Figaro.env.opentok_api_key, token: token } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment