Browse Source

Add documentation for decode callbacks, link performance page

phoboslab 6 years ago
parent
commit
7d9d4c0c00
1 changed files with 7 additions and 0 deletions
  1. 7 0
      README.md

+ 7 - 0
README.md View File

41
 - `poster` – URL to an image to use as the poster to show before the video plays.
41
 - `poster` – URL to an image to use as the poster to show before the video plays.
42
 - `pauseWhenHidden` – whether to pause playback when the tab is inactive. Default `true`. Note that browsers usually throttle JS in inactive tabs anyway.
42
 - `pauseWhenHidden` – whether to pause playback when the tab is inactive. Default `true`. Note that browsers usually throttle JS in inactive tabs anyway.
43
 - `disableGl` - whether to disable WebGL and always use the Canvas2D renderer. Default `false`.
43
 - `disableGl` - whether to disable WebGL and always use the Canvas2D renderer. Default `false`.
44
+- `disableWebAssembly` - whether to disable WebAssembly and always use JavaScript decoders. Default `false`.
44
 - `preserveDrawingBuffer` – whether the WebGL context is created with `preserveDrawingBuffer` - necessary for "screenshots" via `canvas.toDataURL()`. Default `false`.
45
 - `preserveDrawingBuffer` – whether the WebGL context is created with `preserveDrawingBuffer` - necessary for "screenshots" via `canvas.toDataURL()`. Default `false`.
45
 - `progressive` - whether to load data in chunks (static files only). When enabled, playback can begin before the whole source has been completely loaded. Default `true`.
46
 - `progressive` - whether to load data in chunks (static files only). When enabled, playback can begin before the whole source has been completely loaded. Default `true`.
46
 - `throttled` - when using `progressive`, whether to defer loading chunks when they're not needed for playback yet. Default `true`.
47
 - `throttled` - when using `progressive`, whether to defer loading chunks when they're not needed for playback yet. Default `true`.
49
 - `maxAudioLag` – when streaming, the maximum enqueued audio length in seconds.
50
 - `maxAudioLag` – when streaming, the maximum enqueued audio length in seconds.
50
 - `videoBufferSize` – when streaming, size in bytes for the video decode buffer. Default 512*1024 (512kb). You may have to increase this for very high bitrates.
51
 - `videoBufferSize` – when streaming, size in bytes for the video decode buffer. Default 512*1024 (512kb). You may have to increase this for very high bitrates.
51
 - `audioBufferSize` – when streaming, size in bytes for the audio decode buffer. Default 128*1024 (128kb). You may have to increase this for very high bitrates.
52
 - `audioBufferSize` – when streaming, size in bytes for the audio decode buffer. Default 128*1024 (128kb). You may have to increase this for very high bitrates.
53
+- `onVideoDecode(decoder, time)` – A callback that is called after each decoded and rendered video frame
54
+- `onAudioDecode(decoder, time)` – A callback that is called after each decoded audio frame
52
 
55
 
53
 All options except from `canvas` can also be used with the HTML Element through `data-` attributes. E.g. to specify looping and autoplay in JavaScript:
56
 All options except from `canvas` can also be used with the HTML Element through `data-` attributes. E.g. to specify looping and autoplay in JavaScript:
54
 
57
 
104
 
107
 
105
 This should not be a problem for static files, or if you're only streaming within your local WiFi. If you don't need to support mobile devices, 1080p at 10mbit/s works just fine (if your encoder can keep up). For everything else I would advise you to use 540p (960x540) at 2Mbit/s max.
108
 This should not be a problem for static files, or if you're only streaming within your local WiFi. If you don't need to support mobile devices, 1080p at 10mbit/s works just fine (if your encoder can keep up). For everything else I would advise you to use 540p (960x540) at 2Mbit/s max.
106
 
109
 
110
+Here is a performance comparison with multiple resolutions and features en-/disabled. Test this on your target devices to get a feel for what you can get away with.
111
+
112
+https://jsmpeg.com/perf.html
113
+
107
 
114
 
108
 ## Streaming via WebSockets
115
 ## Streaming via WebSockets
109
 
116