Add fileplayer
This commit is contained in:
parent
a457ea6c8a
commit
c422fa65fc
17 changed files with 2399 additions and 3125 deletions
27
player/raw-file.coffee
Normal file
27
player/raw-file.coffee
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
guessMimeTypeBecauseBrowsersAreDumb = (link) ->
|
||||
m = /.*\.([a-zA-Z0-9]+)[^.]*$/.exec(link)
|
||||
if m
|
||||
return m[1]
|
||||
else
|
||||
# Couldn't guess mime type; give up and hope flash can play it
|
||||
return 'flv'
|
||||
|
||||
window.FilePlayer = class FilePlayer extends VideoJSPlayer
|
||||
constructor: (data) ->
|
||||
if not (this instanceof FilePlayer)
|
||||
return new FilePlayer(data)
|
||||
|
||||
data.meta.direct =
|
||||
480: [{
|
||||
contentType: guessMimeTypeBecauseBrowsersAreDumb(data.id)
|
||||
link: data.id
|
||||
}]
|
||||
super(data)
|
||||
|
||||
load: (data) ->
|
||||
data.meta.direct =
|
||||
480: [{
|
||||
contentType: guessMimeTypeBecauseBrowsersAreDumb(data.id)
|
||||
link: data.id
|
||||
}]
|
||||
super(data)
|
||||
|
|
@ -4,6 +4,8 @@ TYPE_MAP =
|
|||
dm: DailymotionPlayer
|
||||
gd: VideoJSPlayer
|
||||
gp: VideoJSPlayer
|
||||
fi: FilePlayer
|
||||
jw: FilePlayer
|
||||
sc: SoundCloudPlayer
|
||||
li: LivestreamPlayer
|
||||
tw: TwitchPlayer
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@ sortSources = (sources) ->
|
|||
quality: source.quality
|
||||
)
|
||||
|
||||
waitUntilDefined(window, 'videojs', =>
|
||||
videojs.options.flash.swf = '/video-js.swf'
|
||||
)
|
||||
|
||||
window.VideoJSPlayer = class VideoJSPlayer extends Player
|
||||
constructor: (data) ->
|
||||
if not (this instanceof VideoJSPlayer)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue