|
@@ -41,6 +41,7 @@ The `options` argument supports the following properties:
|
41
|
41
|
- `poster` – URL to an image to use as the poster to show before the video plays.
|
42
|
42
|
- `pauseWhenHidden` – whether to pause playback when the tab is inactive. Default `true`. Note that browsers usually throttle JS in inactive tabs anyway.
|
43
|
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
|
45
|
- `preserveDrawingBuffer` – whether the WebGL context is created with `preserveDrawingBuffer` - necessary for "screenshots" via `canvas.toDataURL()`. Default `false`.
|
45
|
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
|
47
|
- `throttled` - when using `progressive`, whether to defer loading chunks when they're not needed for playback yet. Default `true`.
|
|
@@ -49,6 +50,8 @@ The `options` argument supports the following properties:
|
49
|
50
|
- `maxAudioLag` – when streaming, the maximum enqueued audio length in seconds.
|
50
|
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
|
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
|
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,6 +107,10 @@ While JSMpeg can handle 720p video at 30fps even on an iPhone 5S, keep in mind t
|
104
|
107
|
|
105
|
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
|
115
|
## Streaming via WebSockets
|
109
|
116
|
|