diff options
Diffstat (limited to 'client/src/assets/player/video-renderer.ts')
-rw-r--r-- | client/src/assets/player/video-renderer.ts | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/client/src/assets/player/video-renderer.ts b/client/src/assets/player/video-renderer.ts index 2cb05a448..a3415937b 100644 --- a/client/src/assets/player/video-renderer.ts +++ b/client/src/assets/player/video-renderer.ts | |||
@@ -1,9 +1,9 @@ | |||
1 | // Thanks: https://github.com/feross/render-media | 1 | // Thanks: https://github.com/feross/render-media |
2 | // TODO: use render-media once https://github.com/feross/render-media/issues/32 is fixed | 2 | // TODO: use render-media once https://github.com/feross/render-media/issues/32 is fixed |
3 | 3 | ||
4 | import * as MediaElementWrapper from 'mediasource' | 4 | const MediaElementWrapper = require('mediasource') |
5 | import { extname } from 'path' | 5 | import { extname } from 'path' |
6 | import * as videostream from 'videostream' | 6 | const videostream = require('videostream') |
7 | 7 | ||
8 | const VIDEOSTREAM_EXTS = [ | 8 | const VIDEOSTREAM_EXTS = [ |
9 | '.m4a', | 9 | '.m4a', |
@@ -17,7 +17,7 @@ type RenderMediaOptions = { | |||
17 | } | 17 | } |
18 | 18 | ||
19 | function renderVideo ( | 19 | function renderVideo ( |
20 | file, | 20 | file: any, |
21 | elem: HTMLVideoElement, | 21 | elem: HTMLVideoElement, |
22 | opts: RenderMediaOptions, | 22 | opts: RenderMediaOptions, |
23 | callback: (err: Error, renderer: any) => void | 23 | callback: (err: Error, renderer: any) => void |
@@ -27,11 +27,11 @@ function renderVideo ( | |||
27 | return renderMedia(file, elem, opts, callback) | 27 | return renderMedia(file, elem, opts, callback) |
28 | } | 28 | } |
29 | 29 | ||
30 | function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, callback: (err: Error, renderer?: any) => void) { | 30 | function renderMedia (file: any, elem: HTMLVideoElement, opts: RenderMediaOptions, callback: (err: Error, renderer?: any) => void) { |
31 | const extension = extname(file.name).toLowerCase() | 31 | const extension = extname(file.name).toLowerCase() |
32 | let preparedElem = undefined | 32 | let preparedElem: any = undefined |
33 | let currentTime = 0 | 33 | let currentTime = 0 |
34 | let renderer | 34 | let renderer: any |
35 | 35 | ||
36 | try { | 36 | try { |
37 | if (VIDEOSTREAM_EXTS.indexOf(extension) >= 0) { | 37 | if (VIDEOSTREAM_EXTS.indexOf(extension) >= 0) { |
@@ -45,7 +45,7 @@ function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, ca | |||
45 | 45 | ||
46 | function useVideostream () { | 46 | function useVideostream () { |
47 | prepareElem() | 47 | prepareElem() |
48 | preparedElem.addEventListener('error', function onError (err) { | 48 | preparedElem.addEventListener('error', function onError (err: Error) { |
49 | preparedElem.removeEventListener('error', onError) | 49 | preparedElem.removeEventListener('error', onError) |
50 | 50 | ||
51 | return callback(err) | 51 | return callback(err) |
@@ -58,7 +58,7 @@ function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, ca | |||
58 | const codecs = getCodec(file.name, useVP9) | 58 | const codecs = getCodec(file.name, useVP9) |
59 | 59 | ||
60 | prepareElem() | 60 | prepareElem() |
61 | preparedElem.addEventListener('error', function onError (err) { | 61 | preparedElem.addEventListener('error', function onError (err: Error) { |
62 | preparedElem.removeEventListener('error', onError) | 62 | preparedElem.removeEventListener('error', onError) |
63 | 63 | ||
64 | // Try with vp9 before returning an error | 64 | // Try with vp9 before returning an error |
@@ -102,7 +102,7 @@ function renderMedia (file, elem: HTMLVideoElement, opts: RenderMediaOptions, ca | |||
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | function validateFile (file) { | 105 | function validateFile (file: any) { |
106 | if (file == null) { | 106 | if (file == null) { |
107 | throw new Error('file cannot be null or undefined') | 107 | throw new Error('file cannot be null or undefined') |
108 | } | 108 | } |