sync/player/raw-file.coffee

32 lines
975 B
CoffeeScript
Raw Permalink Normal View History

2015-07-03 18:24:21 +00:00
codecToMimeType = (codec) ->
switch codec
2020-11-18 07:17:59 +00:00
when 'mov/h264', 'mov/av1' then 'video/mp4'
2015-07-03 18:24:21 +00:00
when 'flv/h264' then 'video/flv'
2020-11-18 07:17:59 +00:00
when 'matroska/vp8', 'matroska/vp9', 'matroska/av1' then 'video/webm'
2015-07-03 18:24:21 +00:00
when 'ogg/theora' then 'video/ogg'
when 'mp3' then 'audio/mp3'
when 'vorbis' then 'audio/ogg'
2016-12-18 03:53:17 +00:00
when 'aac' then 'audio/aac'
2020-11-18 07:17:59 +00:00
when 'opus' then 'audio/opus'
2015-07-03 18:24:21 +00:00
else 'video/flv'
2015-07-01 16:38:01 +00:00
window.FilePlayer = class FilePlayer extends VideoJSPlayer
constructor: (data) ->
if not (this instanceof FilePlayer)
return new FilePlayer(data)
data.meta.direct =
480: [{
2015-07-03 18:24:21 +00:00
contentType: codecToMimeType(data.meta.codec)
2015-07-01 16:38:01 +00:00
link: data.id
}]
super(data)
load: (data) ->
data.meta.direct =
480: [{
2015-07-03 18:24:21 +00:00
contentType: codecToMimeType(data.meta.codec)
2015-07-01 16:38:01 +00:00
link: data.id
}]
super(data)