2015-04-08 19:34:05 +00:00
|
|
|
# one time init stuff for the /client view
|
|
|
|
|
|
|
|
|
|
$ = jQuery
|
|
|
|
|
context = window
|
|
|
|
|
context.JK ||= {};
|
2015-07-21 18:23:12 +00:00
|
|
|
logger = context.JK.logger
|
2015-04-08 19:34:05 +00:00
|
|
|
|
|
|
|
|
context.JK.ClientInit = class ClientInit
|
|
|
|
|
constructor: () ->
|
|
|
|
|
@gearUtils = context.JK.GearUtils
|
2015-06-10 13:26:45 +00:00
|
|
|
@ALERT_NAMES = context.JK.ALERT_NAMES;
|
|
|
|
|
@lastCheckedBroadcast = null
|
2015-04-08 19:34:05 +00:00
|
|
|
|
|
|
|
|
init: () =>
|
|
|
|
|
if context.gon.isNativeClient
|
|
|
|
|
this.nativeClientInit()
|
|
|
|
|
|
2015-06-10 13:26:45 +00:00
|
|
|
context.JK.onBackendEvent(@ALERT_NAMES.WINDOW_OPEN_FOREGROUND_MODE, 'client_init', @watchBroadcast);
|
|
|
|
|
|
|
|
|
|
this.watchBroadcast()
|
|
|
|
|
|
2016-03-10 20:57:14 +00:00
|
|
|
if context.jamClient.RegisterSessionJoinLeaveRequestCallBack?
|
2016-03-10 14:10:43 +00:00
|
|
|
context.jamClient.RegisterSessionJoinLeaveRequestCallBack("SessionStore.handleJoinLeaveRequestCallback")
|
|
|
|
|
|
2015-06-10 13:26:45 +00:00
|
|
|
checkBroadcast: () =>
|
2016-03-10 22:09:46 +00:00
|
|
|
promise = window.BroadcastActions.load.trigger()
|
2015-07-21 18:23:12 +00:00
|
|
|
if promise
|
|
|
|
|
promise.catch(() ->
|
|
|
|
|
false
|
|
|
|
|
)
|
2015-07-15 15:04:45 +00:00
|
|
|
|
2015-06-10 13:26:45 +00:00
|
|
|
|
|
|
|
|
watchBroadcast: () =>
|
|
|
|
|
if context.JK.currentUserId
|
|
|
|
|
# create a 15 second buffer to not check too fast for some reason (like the client firing multiple foreground events)
|
|
|
|
|
if !@lastCheckedBroadcast? || @lastCheckedBroadcast.getTime() < new Date().getTime() - 15000
|
|
|
|
|
@lastCheckedBroadcast = new Date()
|
|
|
|
|
setTimeout(@checkBroadcast, 3000)
|
|
|
|
|
|
|
|
|
|
|
2015-04-08 19:34:05 +00:00
|
|
|
nativeClientInit: () =>
|
|
|
|
|
@gearUtils.bootstrapDefaultPlaybackProfile();
|
2022-01-18 14:50:45 +00:00
|
|
|
|
|
|
|
|
context.VideoActions.checkPromptConfigureVideo()
|
2015-08-30 10:00:00 +00:00
|
|
|
|
2015-06-10 13:26:45 +00:00
|
|
|
|