jmuxer 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/codeStyles/Project.xml +13 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/jmuxer.iml +9 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/README.md +38 -14
- package/dist/jmuxer.js +346 -253
- package/dist/jmuxer.min.js +1 -1
- package/package.json +1 -1
- package/src/controller/remux.js +4 -1
- package/src/jmuxer.js +36 -8
- package/src/parsers/aac.js +5 -9
- package/src/remuxer/aac.js +4 -0
- package/src/remuxer/h264.js +2 -1
- package/test/parser.js +4 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
+
<code_scheme name="Project" version="173">
|
|
3
|
+
<JSCodeStyleSettings version="0">
|
|
4
|
+
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
5
|
+
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
6
|
+
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
7
|
+
</JSCodeStyleSettings>
|
|
8
|
+
<codeStyleSettings language="JavaScript">
|
|
9
|
+
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
|
10
|
+
<option name="ALIGN_MULTILINE_FOR" value="false" />
|
|
11
|
+
</codeStyleSettings>
|
|
12
|
+
</code_scheme>
|
|
13
|
+
</component>
|
package/.idea/jmuxer.iml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$" />
|
|
6
|
+
<orderEntry type="inheritedJdk" />
|
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
+
</component>
|
|
9
|
+
</module>
|
package/.idea/misc.xml
ADDED
package/.idea/vcs.xml
ADDED
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[](https://travis-ci.org/samirkumardas/jmuxer)
|
|
2
|
-

|
|
3
3
|

|
|
4
4
|
|
|
5
5
|
jMuxer
|
|
@@ -15,10 +15,10 @@ Live Demo
|
|
|
15
15
|
How to use?
|
|
16
16
|
-------
|
|
17
17
|
A distribution version is available on dist folder.
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
```html
|
|
20
20
|
<script type="text/javascript" src="dist/jmuxer.min.js"></script>
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
var jmuxer = new JMuxer(option);
|
|
23
23
|
```
|
|
24
24
|
|
|
@@ -40,18 +40,24 @@ Available options are:
|
|
|
40
40
|
|
|
41
41
|
*onReady* - function. Will be called once MSE is ready.
|
|
42
42
|
|
|
43
|
-
*
|
|
43
|
+
*onData* - function. Will be called when muxed data is ready to be used. First argument is the muxed data.
|
|
44
|
+
|
|
45
|
+
*onError* - function. Will be fired if jMuxer encounters any buffer related errors.
|
|
46
|
+
|
|
47
|
+
*onMissingVideoFrames* - function. Will be fired if jMuxer encounters any missing video frames.
|
|
48
|
+
|
|
49
|
+
*onMissingAudioFrames* - function. Will be fired if jMuxer encounters any missing audio frames.
|
|
44
50
|
|
|
45
51
|
*debug* - true/false. Will print debug log in browser console. Default is false.
|
|
46
52
|
|
|
47
53
|
**Complete example:**
|
|
48
54
|
|
|
49
55
|
```html
|
|
50
|
-
|
|
56
|
+
|
|
51
57
|
<script type="text/javascript" src="dist/jmuxer.min.js"></script>
|
|
52
|
-
|
|
58
|
+
|
|
53
59
|
<video id="player"></video>
|
|
54
|
-
|
|
60
|
+
|
|
55
61
|
<script>
|
|
56
62
|
var jmuxer = new JMuxer({
|
|
57
63
|
node: 'player',
|
|
@@ -65,7 +71,7 @@ Available options are:
|
|
|
65
71
|
video: video,
|
|
66
72
|
duration: duration
|
|
67
73
|
});
|
|
68
|
-
|
|
74
|
+
|
|
69
75
|
</script>
|
|
70
76
|
|
|
71
77
|
```
|
|
@@ -78,6 +84,8 @@ Media dataObject may have following properties:
|
|
|
78
84
|
|
|
79
85
|
*duration* - duration in milliseconds of the provided chunk. If duration is not provided, it will calculate frame duration wtih the provided frame rate (fps).
|
|
80
86
|
|
|
87
|
+
*compositionTimeOffset* - Composition time offset, difference between decode time and presentation time of frames, in milliseconds. This is only used for video and usually needed when B-frames are present in video stream.
|
|
88
|
+
|
|
81
89
|
**ES6 Example:**
|
|
82
90
|
|
|
83
91
|
Install module through `npm`
|
|
@@ -92,7 +100,7 @@ const jmuxer = new JMuxer({
|
|
|
92
100
|
node: 'player',
|
|
93
101
|
debug: true
|
|
94
102
|
});
|
|
95
|
-
|
|
103
|
+
|
|
96
104
|
/* Now feed media data using feed method. audio and video is buffer data and duration is in milliseconds */
|
|
97
105
|
jmuxer.feed({
|
|
98
106
|
audio: audio,
|
|
@@ -115,13 +123,29 @@ const jmuxer = new JMuxer({
|
|
|
115
123
|
debug: true
|
|
116
124
|
});
|
|
117
125
|
|
|
118
|
-
/*
|
|
126
|
+
/*
|
|
119
127
|
Stream in Object mode. Please check the example file for more details
|
|
120
128
|
*/
|
|
121
129
|
let h264_feeder = getFeederStreamSomehow();
|
|
122
130
|
let http_or_ws_or_any = getWritterStreamSomehow();
|
|
123
131
|
h264_feeder.pipe(jmuxer.createStream()).pipe(http_or_ws_or_any);
|
|
124
132
|
|
|
133
|
+
|
|
134
|
+
// OR another way
|
|
135
|
+
|
|
136
|
+
const jmuxer = new JMuxer({
|
|
137
|
+
onData: function(data) {
|
|
138
|
+
res.write(data); // send data to client
|
|
139
|
+
}
|
|
140
|
+
debug: true
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
jmuxer.feed({
|
|
144
|
+
audio: audio,
|
|
145
|
+
video: video,
|
|
146
|
+
duration: duration
|
|
147
|
+
}); // feed data
|
|
148
|
+
|
|
125
149
|
```
|
|
126
150
|
|
|
127
151
|
**Available Methods**
|
|
@@ -135,12 +159,12 @@ h264_feeder.pipe(jmuxer.createStream()).pipe(http_or_ws_or_any);
|
|
|
135
159
|
|
|
136
160
|
**Typescript definition**
|
|
137
161
|
|
|
138
|
-
|
|
162
|
+
|
|
139
163
|
npm install --save @types/jmuxer
|
|
140
164
|
|
|
141
|
-
|
|
165
|
+
|
|
142
166
|
**Compatibility**
|
|
143
|
-
|
|
167
|
+
|
|
144
168
|
compatible with browsers supporting MSE with 'video/MP4. it is supported on:
|
|
145
169
|
|
|
146
170
|
* Chrome for Android 34+
|
|
@@ -200,7 +224,7 @@ A distribution version is available inside *dist* directory. However, if you nee
|
|
|
200
224
|
|
|
201
225
|
Support
|
|
202
226
|
-----------
|
|
203
|
-
If the project helps you, [buy me a cup of coffee!](https://www.paypal.com/cgi-bin/webscr?cmd=_donations¤cy_code=USD&business=
|
|
227
|
+
If the project helps you, [buy me a cup of coffee!](https://www.paypal.com/cgi-bin/webscr?cmd=_donations¤cy_code=USD&business=samir@ascendtechnologies.net&item_name=donation%20for%20jMuxer)
|
|
204
228
|
|
|
205
229
|
Credits
|
|
206
230
|
-----------
|