rx-player 3.33.1 → 3.33.3
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/CHANGELOG.md +1080 -1129
- package/VERSION +1 -1
- package/dist/_esm5.processed/compat/can_rely_on_request_media_key_system_access.d.ts +34 -0
- package/dist/_esm5.processed/compat/can_rely_on_request_media_key_system_access.js +40 -0
- package/dist/_esm5.processed/compat/generate_init_data.d.ts +14 -0
- package/dist/_esm5.processed/compat/generate_init_data.js +61 -0
- package/dist/_esm5.processed/compat/may_media_element_fail_on_undecipherable_data.d.ts +16 -0
- package/dist/_esm5.processed/compat/may_media_element_fail_on_undecipherable_data.js +17 -0
- package/dist/_esm5.processed/compat/should_wait_for_data_before_loaded.d.ts +1 -1
- package/dist/_esm5.processed/compat/should_wait_for_data_before_loaded.js +5 -3
- package/dist/_esm5.processed/config.d.ts +2 -0
- package/dist/_esm5.processed/core/adaptive/adaptive_representation_selector.js +1 -1
- package/dist/_esm5.processed/core/api/debug/buffer_graph.js +3 -3
- package/dist/_esm5.processed/core/api/public_api.d.ts +17 -0
- package/dist/_esm5.processed/core/api/public_api.js +41 -2
- package/dist/_esm5.processed/core/api/tracks_management/media_element_track_choice_manager.js +21 -25
- package/dist/_esm5.processed/core/decrypt/attach_media_keys.js +6 -6
- package/dist/_esm5.processed/core/decrypt/find_key_system.d.ts +10 -0
- package/dist/_esm5.processed/core/decrypt/find_key_system.js +42 -1
- package/dist/_esm5.processed/core/decrypt/session_events_listener.js +2 -2
- package/dist/_esm5.processed/core/fetchers/manifest/manifest_fetcher.js +2 -2
- package/dist/_esm5.processed/core/fetchers/segment/segment_fetcher.js +1 -1
- package/dist/_esm5.processed/core/init/media_source_content_initializer.js +34 -12
- package/dist/_esm5.processed/core/init/utils/get_loaded_reference.js +6 -1
- package/dist/_esm5.processed/core/init/utils/initial_seek_and_play.js +4 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/audio_video/audio_video_segment_buffer.js +24 -25
- package/dist/_esm5.processed/core/segment_buffers/implementations/image/image_segment_buffer.js +1 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/html_text_segment_buffer.js +1 -1
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/text_track_cues_store.js +2 -2
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.d.ts +15 -0
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/html/utils.js +23 -0
- package/dist/_esm5.processed/core/segment_buffers/implementations/text/native/native_text_segment_buffer.js +1 -1
- package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.d.ts +18 -4
- package/dist/_esm5.processed/core/segment_buffers/inventory/segment_inventory.js +57 -13
- package/dist/_esm5.processed/core/stream/adaptation/adaptation_stream.js +3 -0
- package/dist/_esm5.processed/core/stream/representation/utils/append_segment_to_buffer.js +15 -8
- package/dist/_esm5.processed/core/stream/representation/utils/get_buffer_status.js +1 -37
- package/dist/_esm5.processed/core/stream/representation/utils/get_needed_segments.js +19 -11
- package/dist/_esm5.processed/core/stream/representation/utils/push_init_segment.js +6 -6
- package/dist/_esm5.processed/core/stream/representation/utils/push_media_segment.js +9 -9
- package/dist/_esm5.processed/default_config.d.ts +31 -0
- package/dist/_esm5.processed/default_config.js +48 -17
- package/dist/_esm5.processed/errors/assertion_error.d.ts +0 -1
- package/dist/_esm5.processed/errors/assertion_error.js +1 -2
- package/dist/_esm5.processed/errors/custom_loader_error.d.ts +0 -1
- package/dist/_esm5.processed/errors/custom_loader_error.js +1 -2
- package/dist/_esm5.processed/errors/encrypted_media_error.d.ts +0 -1
- package/dist/_esm5.processed/errors/encrypted_media_error.js +1 -2
- package/dist/_esm5.processed/errors/media_error.d.ts +0 -1
- package/dist/_esm5.processed/errors/media_error.js +1 -2
- package/dist/_esm5.processed/errors/network_error.d.ts +0 -1
- package/dist/_esm5.processed/errors/network_error.js +1 -2
- package/dist/_esm5.processed/errors/other_error.d.ts +0 -1
- package/dist/_esm5.processed/errors/other_error.js +1 -2
- package/dist/_esm5.processed/errors/request_error.d.ts +0 -1
- package/dist/_esm5.processed/errors/request_error.js +17 -15
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.d.ts +0 -1
- package/dist/_esm5.processed/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader_error.js +2 -2
- package/dist/_esm5.processed/experimental/tools/createMetaplaylist/get_duration_from_manifest.js +1 -1
- package/dist/_esm5.processed/experimental/tools/mediaCapabilitiesProber/probers/decodingInfo.js +4 -4
- package/dist/_esm5.processed/parsers/containers/isobmff/utils.js +3 -1
- package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +1 -3
- package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representation_index.js +9 -5
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.d.ts +0 -1
- package/dist/_esm5.processed/parsers/manifest/dash/js-parser/node_parsers/utils.js +1 -2
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.d.ts +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.d.ts +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.d.ts +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/Scheme.js +1 -1
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/parsers_stack.d.ts +2 -1
- package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/types.d.ts +55 -55
- package/dist/_esm5.processed/parsers/manifest/smooth/parse_protection_node.js +1 -1
- package/dist/_esm5.processed/transports/dash/extract_complete_chunks.d.ts +1 -1
- package/dist/_esm5.processed/transports/dash/extract_complete_chunks.js +6 -2
- package/dist/_esm5.processed/transports/dash/low_latency_segment_loader.js +4 -2
- package/dist/_esm5.processed/utils/languages/ISO_639-1_to_ISO_639-3.js +182 -182
- package/dist/_esm5.processed/utils/languages/ISO_639-2_to_ISO_639-3.js +19 -19
- package/dist/_esm5.processed/utils/languages/normalize.js +4 -1
- package/dist/_esm5.processed/utils/resolve_url.d.ts +13 -10
- package/dist/_esm5.processed/utils/resolve_url.js +220 -69
- package/dist/_esm5.processed/utils/string_parsing.d.ts +1 -1
- package/dist/_esm5.processed/utils/string_parsing.js +1 -1
- package/dist/_esm5.processed/utils/task_canceller.d.ts +0 -1
- package/dist/_esm5.processed/utils/task_canceller.js +3 -2
- package/dist/mpd-parser.wasm +0 -0
- package/dist/rx-player.d.ts +1 -1
- package/dist/rx-player.js +3951 -3398
- package/dist/rx-player.min.d.ts +1 -1
- package/dist/rx-player.min.js +1 -1
- package/package.json +40 -40
|
@@ -137,9 +137,7 @@ var TimelineRepresentationIndex = /** @class */ (function () {
|
|
|
137
137
|
if (this._index.timeline === null) {
|
|
138
138
|
this._index.timeline = this._getTimeline();
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
var _a = this._index, segmentUrlTemplate = _a.segmentUrlTemplate, startNumber = _a.startNumber, endNumber = _a.endNumber, timeline = _a.timeline, timescale = _a.timescale, indexTimeOffset = _a.indexTimeOffset;
|
|
142
|
-
return getSegmentsFromTimeline({ segmentUrlTemplate: segmentUrlTemplate, startNumber: startNumber, endNumber: endNumber, timeline: timeline, timescale: timescale, indexTimeOffset: indexTimeOffset }, from, duration, this._manifestBoundsCalculator, this._scaledPeriodEnd, this._isEMSGWhitelisted);
|
|
140
|
+
return getSegmentsFromTimeline(this._index, from, duration, this._manifestBoundsCalculator, this._scaledPeriodEnd, this._isEMSGWhitelisted);
|
|
143
141
|
};
|
|
144
142
|
/**
|
|
145
143
|
* Returns true if the index should be refreshed.
|
|
@@ -32,7 +32,7 @@ import { BaseRepresentationIndex, ListRepresentationIndex, TemplateRepresentatio
|
|
|
32
32
|
* @returns {Array.<Object>}
|
|
33
33
|
*/
|
|
34
34
|
export default function parseRepresentationIndex(representation, context) {
|
|
35
|
-
var _a, _b;
|
|
35
|
+
var _a, _b, _c;
|
|
36
36
|
var availabilityTimeOffset = context.availabilityTimeOffset, manifestBoundsCalculator = context.manifestBoundsCalculator, isDynamic = context.isDynamic, periodEnd = context.end, periodStart = context.start, receivedTime = context.receivedTime, unsafelyBaseOnPreviousRepresentation = context.unsafelyBaseOnPreviousRepresentation, inbandEventStreams = context.inbandEventStreams, isLastPeriod = context.isLastPeriod;
|
|
37
37
|
var isEMSGWhitelisted = function (inbandEvent) {
|
|
38
38
|
if (inbandEventStreams === undefined) {
|
|
@@ -81,10 +81,14 @@ export default function parseRepresentationIndex(representation, context) {
|
|
|
81
81
|
((_a = segmentTemplate.availabilityTimeOffset) !== null && _a !== void 0 ? _a : 0) +
|
|
82
82
|
((_b = context.availabilityTimeOffset) !== null && _b !== void 0 ? _b : 0);
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
.
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
if (segmentTemplate.availabilityTimeComplete !== undefined ||
|
|
85
|
+
context.availabilityTimeComplete !== undefined) {
|
|
86
|
+
reprIndexCtxt.availabilityTimeComplete =
|
|
87
|
+
(_c = segmentTemplate.availabilityTimeComplete) !== null && _c !== void 0 ? _c : context.availabilityTimeComplete;
|
|
88
|
+
}
|
|
89
|
+
representationIndex = TimelineRepresentationIndex.isTimelineIndexArgument(segmentTemplate)
|
|
90
|
+
? new TimelineRepresentationIndex(segmentTemplate, reprIndexCtxt)
|
|
91
|
+
: new TemplateRepresentationIndex(segmentTemplate, reprIndexCtxt);
|
|
88
92
|
}
|
|
89
93
|
else {
|
|
90
94
|
var adaptationChildren = context.adaptation.children;
|
|
@@ -296,11 +296,10 @@ var MPDError = /** @class */ (function (_super) {
|
|
|
296
296
|
* @param {string} message
|
|
297
297
|
*/
|
|
298
298
|
function MPDError(message) {
|
|
299
|
-
var _this = _super.call(this) || this;
|
|
299
|
+
var _this = _super.call(this, message) || this;
|
|
300
300
|
// @see https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
301
301
|
Object.setPrototypeOf(_this, MPDError.prototype);
|
|
302
302
|
_this.name = "MPDError";
|
|
303
|
-
_this.message = message;
|
|
304
303
|
return _this;
|
|
305
304
|
}
|
|
306
305
|
return MPDError;
|
package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentComponent.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { IContentComponentAttributes } from "../../../node_parser_types";
|
|
|
17
17
|
import { IAttributeParser } from "../parsers_stack";
|
|
18
18
|
/**
|
|
19
19
|
* Generate an "attribute parser" once inside a `BaseURL` node.
|
|
20
|
-
* @param {Object}
|
|
20
|
+
* @param {Object} ccAttrs
|
|
21
21
|
* @param {WebAssembly.Memory} linearMemory
|
|
22
22
|
* @returns {Function}
|
|
23
23
|
*/
|
package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { IContentProtectionIntermediateRepresentation } from "../../../node_parser_types";
|
|
17
17
|
import { IAttributeParser } from "../parsers_stack";
|
|
18
18
|
/**
|
|
19
|
-
* @param {Object}
|
|
19
|
+
* @param {Object} cp
|
|
20
20
|
* @param {WebAssembly.Memory} linearMemory
|
|
21
21
|
* @returns {Function}
|
|
22
22
|
*/
|
package/dist/_esm5.processed/parsers/manifest/dash/wasm-parser/ts/generators/ContentProtection.js
CHANGED
|
@@ -17,7 +17,7 @@ import { base64ToBytes } from "../../../../../../utils/base64";
|
|
|
17
17
|
import { hexToBytes } from "../../../../../../utils/string_parsing";
|
|
18
18
|
import { parseString } from "../utils";
|
|
19
19
|
/**
|
|
20
|
-
* @param {Object}
|
|
20
|
+
* @param {Object} cp
|
|
21
21
|
* @param {WebAssembly.Memory} linearMemory
|
|
22
22
|
* @returns {Function}
|
|
23
23
|
*/
|
|
@@ -17,7 +17,7 @@ import { IScheme } from "../../../node_parser_types";
|
|
|
17
17
|
import { IAttributeParser } from "../parsers_stack";
|
|
18
18
|
/**
|
|
19
19
|
* Generate an "attribute parser" once inside a `BaseURL` node.
|
|
20
|
-
* @param {Object}
|
|
20
|
+
* @param {Object} schemeAttrs
|
|
21
21
|
* @param {WebAssembly.Memory} linearMemory
|
|
22
22
|
* @returns {Function}
|
|
23
23
|
*/
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { AttributeName } from "./types";
|
|
16
17
|
/** Type of the function called when a Node opening is encountered. */
|
|
17
18
|
export type IChildrenParser = (node: number) => void;
|
|
18
19
|
/** Type of the function called when an attribute is encountered. */
|
|
19
|
-
export type IAttributeParser = (attr:
|
|
20
|
+
export type IAttributeParser = (attr: AttributeName, ptr: number, len: number) => void;
|
|
20
21
|
/**
|
|
21
22
|
* Maintains a stack of children and attributes parsers, to easily parse
|
|
22
23
|
* the very hierarchical MPDs.
|
|
@@ -68,66 +68,66 @@ export declare const enum AttributeName {
|
|
|
68
68
|
Duration = 1,
|
|
69
69
|
Profiles = 2,
|
|
70
70
|
AudioSamplingRate = 3,
|
|
71
|
-
Codecs = 4
|
|
71
|
+
Codecs = 4,// String
|
|
72
72
|
CodingDependency = 5,
|
|
73
73
|
FrameRate = 6,
|
|
74
|
-
Height = 7
|
|
75
|
-
Width = 8
|
|
74
|
+
Height = 7,// f64
|
|
75
|
+
Width = 8,// f64
|
|
76
76
|
MaxPlayoutRate = 9,
|
|
77
77
|
MaxSAPPeriod = 10,
|
|
78
|
-
MimeType = 11
|
|
78
|
+
MimeType = 11,// f64
|
|
79
79
|
SegmentProfiles = 12,
|
|
80
|
-
ContentProtectionValue = 13
|
|
81
|
-
ContentProtectionKeyId = 14
|
|
82
|
-
ContentProtectionCencPSSH = 15
|
|
83
|
-
SchemeIdUri = 16
|
|
84
|
-
SchemeValue = 17
|
|
85
|
-
MediaRange = 18,
|
|
86
|
-
SegmentTimeline = 19
|
|
87
|
-
StartNumber = 20
|
|
88
|
-
SegmentBaseSegment = 21
|
|
89
|
-
AvailabilityTimeComplete = 22
|
|
90
|
-
IndexRangeExact = 23
|
|
91
|
-
PresentationTimeOffset = 24
|
|
92
|
-
EventPresentationTime = 25
|
|
93
|
-
Element = 26
|
|
94
|
-
TimeScale = 27
|
|
95
|
-
Index = 28
|
|
96
|
-
InitializationRange = 29,
|
|
97
|
-
Media = 30
|
|
98
|
-
IndexRange = 31,
|
|
99
|
-
BitstreamSwitching = 32
|
|
100
|
-
Type = 33
|
|
101
|
-
AvailabilityStartTime = 34
|
|
102
|
-
AvailabilityEndTime = 35
|
|
103
|
-
PublishTime = 36
|
|
104
|
-
MinimumUpdatePeriod = 37
|
|
105
|
-
MinBufferTime = 38
|
|
106
|
-
TimeShiftBufferDepth = 39
|
|
107
|
-
SuggestedPresentationDelay = 40
|
|
108
|
-
MaxSegmentDuration = 41
|
|
109
|
-
MaxSubsegmentDuration = 42
|
|
110
|
-
AvailabilityTimeOffset = 43
|
|
111
|
-
BaseUrlValue = 44
|
|
112
|
-
Start = 45
|
|
113
|
-
XLinkHref = 46
|
|
114
|
-
XLinkActuate = 47
|
|
80
|
+
ContentProtectionValue = 13,// String
|
|
81
|
+
ContentProtectionKeyId = 14,// ArrayBuffer
|
|
82
|
+
ContentProtectionCencPSSH = 15,// ArrayBuffer
|
|
83
|
+
SchemeIdUri = 16,// String
|
|
84
|
+
SchemeValue = 17,// String
|
|
85
|
+
MediaRange = 18,// [f64, f64]
|
|
86
|
+
SegmentTimeline = 19,// Vec<SElement>
|
|
87
|
+
StartNumber = 20,// f64
|
|
88
|
+
SegmentBaseSegment = 21,// SegmentBaseSegment
|
|
89
|
+
AvailabilityTimeComplete = 22,// u8 (bool)
|
|
90
|
+
IndexRangeExact = 23,// u8 (bool)
|
|
91
|
+
PresentationTimeOffset = 24,// f64
|
|
92
|
+
EventPresentationTime = 25,// f64
|
|
93
|
+
Element = 26,// String (XML)
|
|
94
|
+
TimeScale = 27,// f64
|
|
95
|
+
Index = 28,// String
|
|
96
|
+
InitializationRange = 29,// [f64, f64]
|
|
97
|
+
Media = 30,// String
|
|
98
|
+
IndexRange = 31,// [f64, f64]
|
|
99
|
+
BitstreamSwitching = 32,// u8 (bool)
|
|
100
|
+
Type = 33,// String
|
|
101
|
+
AvailabilityStartTime = 34,// f64
|
|
102
|
+
AvailabilityEndTime = 35,// f64
|
|
103
|
+
PublishTime = 36,// f64
|
|
104
|
+
MinimumUpdatePeriod = 37,// f64
|
|
105
|
+
MinBufferTime = 38,// f64
|
|
106
|
+
TimeShiftBufferDepth = 39,// f64
|
|
107
|
+
SuggestedPresentationDelay = 40,// f64
|
|
108
|
+
MaxSegmentDuration = 41,// f64
|
|
109
|
+
MaxSubsegmentDuration = 42,// f64
|
|
110
|
+
AvailabilityTimeOffset = 43,// f64
|
|
111
|
+
BaseUrlValue = 44,// String
|
|
112
|
+
Start = 45,// f64
|
|
113
|
+
XLinkHref = 46,// String
|
|
114
|
+
XLinkActuate = 47,// String
|
|
115
115
|
Group = 48,
|
|
116
|
-
MaxBandwidth = 49
|
|
117
|
-
MaxFrameRate = 50
|
|
118
|
-
MaxHeight = 51
|
|
119
|
-
MaxWidth = 52
|
|
120
|
-
MinBandwidth = 53
|
|
121
|
-
MinFrameRate = 54
|
|
122
|
-
MinHeight = 55
|
|
123
|
-
MinWidth = 56
|
|
116
|
+
MaxBandwidth = 49,// f64
|
|
117
|
+
MaxFrameRate = 50,// f64
|
|
118
|
+
MaxHeight = 51,// f64
|
|
119
|
+
MaxWidth = 52,// f64
|
|
120
|
+
MinBandwidth = 53,// f64
|
|
121
|
+
MinFrameRate = 54,// f64
|
|
122
|
+
MinHeight = 55,// f64
|
|
123
|
+
MinWidth = 56,// f64
|
|
124
124
|
SelectionPriority = 57,
|
|
125
125
|
SegmentAlignment = 58,
|
|
126
126
|
SubsegmentAlignment = 59,
|
|
127
|
-
Language = 60
|
|
128
|
-
ContentType = 61
|
|
127
|
+
Language = 60,// String
|
|
128
|
+
ContentType = 61,// String
|
|
129
129
|
Par = 62,
|
|
130
|
-
Bitrate = 63
|
|
130
|
+
Bitrate = 63,// f64
|
|
131
131
|
Text = 64,
|
|
132
132
|
QualityRanking = 65,
|
|
133
133
|
Location = 66,
|
|
@@ -135,11 +135,11 @@ export declare const enum AttributeName {
|
|
|
135
135
|
MediaPresentationDuration = 68,
|
|
136
136
|
EventStreamEltRange = 69,
|
|
137
137
|
Namespace = 70,
|
|
138
|
-
Label = 71
|
|
139
|
-
ServiceLocation = 72
|
|
140
|
-
QueryBeforeStart = 73
|
|
141
|
-
ProxyServerUrl = 74
|
|
138
|
+
Label = 71,// String
|
|
139
|
+
ServiceLocation = 72,// String
|
|
140
|
+
QueryBeforeStart = 73,// Boolean
|
|
141
|
+
ProxyServerUrl = 74,// String
|
|
142
142
|
DefaultServiceLocation = 75,
|
|
143
|
-
EndNumber = 76
|
|
143
|
+
EndNumber = 76,// f64
|
|
144
144
|
SupplementalCodecs = 77
|
|
145
145
|
}
|
|
@@ -22,7 +22,7 @@ import { getPlayReadyKIDFromPrivateData } from "../../containers/isobmff";
|
|
|
22
22
|
* @returns {Array.<Object>}
|
|
23
23
|
*/
|
|
24
24
|
function createWidevineKeySystem(keyIdBytes) {
|
|
25
|
-
return [{ systemId: "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",
|
|
25
|
+
return [{ systemId: "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed", // Widevine
|
|
26
26
|
privateData: concat([0x08, 0x01, 0x12, 0x10], keyIdBytes) }];
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
@@ -21,4 +21,4 @@
|
|
|
21
21
|
* @param {Uint8Array} buffer
|
|
22
22
|
* @returns {Array}
|
|
23
23
|
*/
|
|
24
|
-
export default function extractCompleteChunks(buffer: Uint8Array): [Uint8Array[], Uint8Array | null];
|
|
24
|
+
export default function extractCompleteChunks(buffer: Uint8Array): [Uint8Array[] | null, Uint8Array | null];
|
|
@@ -26,8 +26,9 @@ import findCompleteBox from "../utils/find_complete_box";
|
|
|
26
26
|
export default function extractCompleteChunks(buffer) {
|
|
27
27
|
var _position = 0;
|
|
28
28
|
var chunks = [];
|
|
29
|
+
var currentBuffer = null;
|
|
29
30
|
while (_position < buffer.length) {
|
|
30
|
-
|
|
31
|
+
currentBuffer = buffer.subarray(_position, Infinity);
|
|
31
32
|
var moofIndex = findCompleteBox(currentBuffer, 0x6D6F6F66 /* moof */);
|
|
32
33
|
if (moofIndex < 0) {
|
|
33
34
|
// no moof, not a segment.
|
|
@@ -55,5 +56,8 @@ export default function extractCompleteChunks(buffer) {
|
|
|
55
56
|
chunks.push(chunk);
|
|
56
57
|
_position = maxEnd;
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
+
if (chunks.length === 0) {
|
|
60
|
+
return [null, currentBuffer];
|
|
61
|
+
}
|
|
62
|
+
return [chunks, currentBuffer];
|
|
59
63
|
}
|
|
@@ -45,8 +45,10 @@ export default function lowLatencySegmentLoader(url, content, options, callbacks
|
|
|
45
45
|
var res = extractCompleteChunks(concatenated);
|
|
46
46
|
var completeChunks = res[0];
|
|
47
47
|
partialChunk = res[1];
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if (completeChunks !== null) {
|
|
49
|
+
completeChunks.forEach(function (completedChunk) {
|
|
50
|
+
callbacks.onNewChunk(completedChunk);
|
|
51
|
+
});
|
|
50
52
|
if (cancelSignal.isCancelled()) {
|
|
51
53
|
return;
|
|
52
54
|
}
|