Use VideoJSPlayer for vimeo workaround
This commit is contained in:
parent
b34f972629
commit
7fee1414e2
6 changed files with 43 additions and 120 deletions
|
|
@ -14,7 +14,9 @@ TYPE_MAP =
|
|||
im: ImgurPlayer
|
||||
|
||||
window.loadMediaPlayer = (data) ->
|
||||
if data.type of TYPE_MAP
|
||||
if data.meta.direct
|
||||
window.PLAYER = new VideoJSPlayer(data)
|
||||
else if data.type of TYPE_MAP
|
||||
try
|
||||
window.PLAYER = TYPE_MAP[data.type](data)
|
||||
catch e
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ sortSources = (sources) ->
|
|||
flv = []
|
||||
nonflv = []
|
||||
sources[quality].forEach((source) ->
|
||||
source.quality = quality
|
||||
if source.contentType == 'flv'
|
||||
flv.push(source)
|
||||
else
|
||||
|
|
@ -28,6 +29,7 @@ sortSources = (sources) ->
|
|||
return sourceOrder.concat(flvOrder).map((source) ->
|
||||
type: "video/#{source.contentType}"
|
||||
src: source.link
|
||||
quality: source.quality
|
||||
)
|
||||
|
||||
window.VideoJSPlayer = class VideoJSPlayer extends Player
|
||||
|
|
@ -45,18 +47,17 @@ window.VideoJSPlayer = class VideoJSPlayer extends Player
|
|||
|
||||
sources = sortSources(data.meta.direct)
|
||||
if sources.length == 0
|
||||
# Temporary fix for race condition caused by channel playlist
|
||||
# sending a changeMedia in onPostUserJoin before mediarefresher
|
||||
# has refreshed it.
|
||||
# TODO: Actually fix this on the server side rather than this
|
||||
# hack.
|
||||
console.error('VideoJSPlayer::constructor(): data.meta.direct
|
||||
has no sources!')
|
||||
@mediaType = null
|
||||
return
|
||||
|
||||
sources.forEach((source) ->
|
||||
$('<source/>').attr('src', source.src)
|
||||
.attr('type', source.type)
|
||||
.appendTo(video)
|
||||
$('<source/>').attr(
|
||||
src: source.src
|
||||
type: source.type
|
||||
'data-quality': source.quality
|
||||
).appendTo(video)
|
||||
)
|
||||
|
||||
@player = videojs(video[0], autoplay: true, controls: true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue