Create 1.1-indev branch, list of updates in README
This commit is contained in:
parent
8ca4aa4327
commit
3f27bfdbdf
45 changed files with 16057 additions and 11847 deletions
|
|
@ -5,6 +5,9 @@ window.Player = class Player
|
|||
|
||||
@setMediaProperties(data)
|
||||
@paused = false
|
||||
@latched = true
|
||||
@seeklatch = false #used to lock sync latch when seeking for sync
|
||||
@lastSTime = 0
|
||||
|
||||
load: (data) ->
|
||||
@setMediaProperties(data)
|
||||
|
|
@ -19,7 +22,20 @@ window.Player = class Player
|
|||
|
||||
pause: ->
|
||||
@paused = true
|
||||
|
||||
latch: ->
|
||||
if not @latched
|
||||
@latched = true
|
||||
unlatch: ->
|
||||
if not @seeklatch
|
||||
if @latched
|
||||
$("#latchvid").show()
|
||||
@latched = false
|
||||
else
|
||||
@seeklatch = false
|
||||
latchseek: ->
|
||||
@seeklatch = true
|
||||
getLatch: (cb) ->
|
||||
cb(@latched)
|
||||
seekTo: (time) ->
|
||||
|
||||
setVolume: (volume) ->
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ window.DailymotionPlayer = class DailymotionPlayer extends Player
|
|||
@setMediaProperties(data)
|
||||
@initialVolumeSet = false
|
||||
@playbackReadyCb = null
|
||||
@latched = true
|
||||
|
||||
waitUntilDefined(window, 'DM', =>
|
||||
removeOld()
|
||||
|
|
@ -37,6 +38,8 @@ window.DailymotionPlayer = class DailymotionPlayer extends Player
|
|||
@paused = true
|
||||
if CLIENT.leader
|
||||
sendVideoUpdate()
|
||||
else
|
||||
@unlatch()
|
||||
)
|
||||
|
||||
@dm.addEventListener('playing', =>
|
||||
|
|
@ -48,6 +51,11 @@ window.DailymotionPlayer = class DailymotionPlayer extends Player
|
|||
@setVolume(VOLUME)
|
||||
@initialVolumeSet = true
|
||||
)
|
||||
|
||||
@dm.addEventListener('seeked', =>
|
||||
if not CLIENT.leader
|
||||
@unlatch()
|
||||
)
|
||||
|
||||
# Once the video stops, the internal state of the player
|
||||
# becomes unusable and attempting to load() will corrupt it and
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ TYPE_MAP =
|
|||
tc: TwitchClipPlayer
|
||||
cm: VideoJSPlayer
|
||||
|
||||
|
||||
window.loadMediaPlayer = (data) ->
|
||||
try
|
||||
if window.PLAYER
|
||||
|
|
@ -41,16 +42,20 @@ window.handleMediaUpdate = (data) ->
|
|||
PLAYER = window.PLAYER
|
||||
|
||||
#bodge for fcyp.js layout
|
||||
handleWindowResize()
|
||||
#handleWindowResize()
|
||||
|
||||
#update airdate
|
||||
dispSTimes();
|
||||
|
||||
PLAYER.lastSTime = data.currentTime;
|
||||
if not PLAYER.latched #check if the shits latched, if not stop while we're ahead.
|
||||
return
|
||||
|
||||
# Do not update if the current time is past the end of the video, unless
|
||||
# the video has length 0 (which is a special case for livestreams)
|
||||
if typeof PLAYER.mediaLength is 'number' and
|
||||
if (typeof PLAYER.mediaLength is 'number' and
|
||||
PLAYER.mediaLength > 0 and
|
||||
data.currentTime > PLAYER.mediaLength
|
||||
data.currentTime > PLAYER.mediaLength)
|
||||
return
|
||||
|
||||
# Negative currentTime indicates a lead-in for clients to load the video,
|
||||
|
|
@ -66,6 +71,7 @@ window.handleMediaUpdate = (data) ->
|
|||
|
||||
if waiting
|
||||
PLAYER.seekTo(0)
|
||||
PLAYER.latchseek()
|
||||
# YouTube player has a race condition that crashes the player if
|
||||
# play(), seek(0), and pause() are called quickly without waiting
|
||||
# for events to fire. Setting a flag variable that is checked in the
|
||||
|
|
@ -83,6 +89,7 @@ window.handleMediaUpdate = (data) ->
|
|||
|
||||
if data.paused and not PLAYER.paused
|
||||
PLAYER.seekTo(data.currentTime)
|
||||
PLAYER.latchseek()
|
||||
PLAYER.pause()
|
||||
else if PLAYER.paused and not data.paused
|
||||
PLAYER.play()
|
||||
|
|
@ -101,6 +108,7 @@ window.handleMediaUpdate = (data) ->
|
|||
if diff > accuracy
|
||||
# The player is behind the correct time
|
||||
PLAYER.seekTo(time)
|
||||
PLAYER.latchseek()
|
||||
else if diff < -accuracy
|
||||
# The player is ahead of the correct time
|
||||
# Don't seek all the way back, to account for possible buffering.
|
||||
|
|
@ -109,7 +117,9 @@ window.handleMediaUpdate = (data) ->
|
|||
if not (PLAYER instanceof DailymotionPlayer)
|
||||
time += 1
|
||||
PLAYER.seekTo(time)
|
||||
PLAYER.latchseek()
|
||||
)
|
||||
|
||||
|
||||
window.removeOld = (replace) ->
|
||||
$('#soundcloud-volume-holder').remove()
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ window.VideoJSPlayer = class VideoJSPlayer extends Player
|
|||
constructor: (data) ->
|
||||
if not (this instanceof VideoJSPlayer)
|
||||
return new VideoJSPlayer(data)
|
||||
|
||||
@load(data)
|
||||
|
||||
loadPlayer: (data) ->
|
||||
|
|
@ -97,20 +96,14 @@ window.VideoJSPlayer = class VideoJSPlayer extends Player
|
|||
).appendTo(video)
|
||||
)
|
||||
|
||||
if data.meta.textTracks
|
||||
data.meta.textTracks.forEach((track) ->
|
||||
label = track.name
|
||||
attrs =
|
||||
src: track.url
|
||||
kind: 'subtitles'
|
||||
type: track.type
|
||||
label: label
|
||||
|
||||
if track.default? and track.default
|
||||
attrs.default = ''
|
||||
|
||||
$('<track/>').attr(attrs).appendTo(video)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@player = videojs(video[0],
|
||||
# https://github.com/Dash-Industry-Forum/dash.js/issues/2184
|
||||
|
|
@ -150,6 +143,9 @@ window.VideoJSPlayer = class VideoJSPlayer extends Player
|
|||
@paused = true
|
||||
if CLIENT.leader
|
||||
sendVideoUpdate()
|
||||
else
|
||||
@unlatch()
|
||||
|
||||
)
|
||||
|
||||
@player.on('play', =>
|
||||
|
|
@ -157,11 +153,14 @@ window.VideoJSPlayer = class VideoJSPlayer extends Player
|
|||
if CLIENT.leader
|
||||
sendVideoUpdate()
|
||||
)
|
||||
|
||||
|
||||
# Workaround for IE-- even after seeking completes, the loading
|
||||
# spinner remains.
|
||||
@player.on('seeked', =>
|
||||
$('.vjs-waiting').removeClass('vjs-waiting')
|
||||
if not CLIENT.leader #this part has nothing to do with IE and all to do with sync latching :P
|
||||
@unlatch()
|
||||
|
||||
)
|
||||
|
||||
# Workaround for Chrome-- it seems that the click bindings for
|
||||
|
|
@ -184,12 +183,27 @@ window.VideoJSPlayer = class VideoJSPlayer extends Player
|
|||
|
||||
load: (data) ->
|
||||
@setMediaProperties(data)
|
||||
@latched = true
|
||||
# Note: VideoJS does have facilities for loading new videos into the
|
||||
# existing player object, however it appears to be pretty glitchy when
|
||||
# a video can't be played (either previous or next video). It's safer
|
||||
# to just reset the entire thing.
|
||||
@destroy()
|
||||
@loadPlayer(data)
|
||||
@setTracks(data)
|
||||
|
||||
setTracks: (data) ->
|
||||
if data.meta.textTracks
|
||||
data.meta.textTracks.forEach((track) ->
|
||||
label = track.name
|
||||
$('<track>').attr(
|
||||
src: track.url
|
||||
kind: 'subtitles'
|
||||
type: track.type
|
||||
label: label
|
||||
default: true
|
||||
).prependTo("video")
|
||||
)
|
||||
|
||||
play: ->
|
||||
@paused = false
|
||||
|
|
@ -200,6 +214,9 @@ window.VideoJSPlayer = class VideoJSPlayer extends Player
|
|||
@paused = true
|
||||
if @player and @player.readyState() > 0
|
||||
@player.pause()
|
||||
if not CLIENT.leader
|
||||
@unlatch()
|
||||
|
||||
|
||||
seekTo: (time) ->
|
||||
if @player and @player.readyState() > 0
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ window.VimeoPlayer = class VimeoPlayer extends Player
|
|||
|
||||
load: (data) ->
|
||||
@setMediaProperties(data)
|
||||
@latched = true
|
||||
|
||||
waitUntilDefined(window, 'Vimeo', =>
|
||||
video = $('<iframe/>')
|
||||
|
|
@ -32,6 +33,9 @@ window.VimeoPlayer = class VimeoPlayer extends Player
|
|||
@paused = true
|
||||
if CLIENT.leader
|
||||
sendVideoUpdate()
|
||||
else
|
||||
@unlatch()
|
||||
|
||||
)
|
||||
|
||||
@vimeo.on('play', =>
|
||||
|
|
@ -39,6 +43,11 @@ window.VimeoPlayer = class VimeoPlayer extends Player
|
|||
if CLIENT.leader
|
||||
sendVideoUpdate()
|
||||
)
|
||||
|
||||
@vimeo.on('seeked', =>
|
||||
if not CLIENT.leader
|
||||
@unlatch()
|
||||
)
|
||||
|
||||
@play()
|
||||
@setVolume(VOLUME)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue