Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(HLS): Add HLS support for non-sequence mode #4623

Merged
merged 28 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5615689
feat(HLS): Add HLS support for non-sequence mode
avelad Oct 26, 2022
ced2ad3
Merge branch 'main' into hls-sequencemode
avelad Oct 26, 2022
0ada236
feat(HLS): Add HLS support for non-sequence mode
avelad Oct 26, 2022
441f110
Merge branch 'main' into hls-sequencemode
avelad Oct 30, 2022
9125fba
feat(HLS): Add HLS support for non-sequence mode
avelad Nov 2, 2022
9cd4fee
Merge branch 'main' into hls-sequencemode
avelad Nov 4, 2022
af638d1
feat(HLS): Add HLS support for non-sequence mode
avelad Nov 4, 2022
61bb05f
Merge branch 'main' into hls-sequencemode
avelad Nov 9, 2022
f6e5c40
feat(HLS): Add HLS support for non-sequence mode
avelad Nov 9, 2022
1ef3602
Merge branch 'main' into hls-sequencemode
avelad Nov 15, 2022
35809c0
feat(HLS): Add HLS support for non-sequence mode
avelad Nov 15, 2022
e69c5d8
feat(HLS): Add HLS support for non-sequence mode
avelad Nov 16, 2022
6eb56e2
feat(HLS): Add HLS support for non-sequence mode
avelad Nov 16, 2022
ded362b
feat(HLS): Add HLS support for non-sequence mode
avelad Nov 17, 2022
0496915
feat(HLS): Add HLS support for non-sequence mode
avelad Nov 17, 2022
5327351
Merge branch 'main' into hls-sequencemode
avelad Nov 18, 2022
8af0bc1
feat(HLS): Add HLS support for non-sequence mode
avelad Nov 18, 2022
e7169bf
Merge branch 'main' into hls-sequencemode
avelad Nov 28, 2022
fa08041
Merge branch 'main' into hls-sequencemode
avelad Dec 8, 2022
18d01f5
Merge branch 'main' into hls-sequencemode
avelad Dec 13, 2022
17a2599
Merge branch 'main' into hls-sequencemode
avelad Jan 9, 2023
5b411d4
Merge branch 'main' into hls-sequencemode
avelad Jan 9, 2023
3fae53d
Merge branch 'main' into hls-sequencemode
avelad Jan 19, 2023
2a24187
Merge branch 'main' into hls-sequencemode
avelad Jan 27, 2023
40a0251
Fix some comments
avelad Jan 30, 2023
b24ef69
Simplify needTransmux
avelad Jan 30, 2023
93266a3
Rename needTimestampOffsetCalculation by attemptTimestampOffsetCalcul…
avelad Jan 30, 2023
f052505
Move comment
avelad Jan 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion demo/common/message_ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ shakaDemo.MessageIds = {
CMCD_SECTION_HEADER: 'DEMO_CMCD_SECTION_HEADER',
CONNECTION_TIMEOUT: 'DEMO_CONNECTION_TIMEOUT',
CONTENT_ID: 'DEMO_CONTENT_ID',
DASH_SEQUENCE_MODE: 'DEMO_DASH_SEQUENCE_MODE',
DEFAULT_AUDIO_CODEC: 'DEMO_DEFAULT_AUDIO_CODEC',
DEFAULT_PRESENTATION_DELAY: 'DEMO_DEFAULT_PRESENTATION_DELAY',
DEFAULT_VIDEO_CODEC: 'DEMO_DEFAULT_VIDEO_CODEC',
Expand All @@ -195,6 +196,7 @@ shakaDemo.MessageIds = {
FORCE_TRANSMUX: 'DEMO_FORCE_TRANSMUX',
FUZZ_FACTOR: 'DEMO_FUZZ_FACTOR',
GAP_DETECTION_THRESHOLD: 'DEMO_GAP_DETECTION_THRESHOLD',
HLS_SEQUENCE_MODE: 'DEMO_HLS_SEQUENCE_MODE',
IGNORE_DASH_EMPTY_ADAPTATION_SET: 'DEMO_IGNORE_DASH_EMPTY_ADAPTATION_SET',
IGNORE_DASH_DRM: 'DEMO_IGNORE_DASH_DRM',
IGNORE_DASH_MAX_SEGMENT_DURATION: 'DEMO_IGNORE_DASH_MAX_SEGMENT_DURATION',
Expand Down Expand Up @@ -255,7 +257,6 @@ shakaDemo.MessageIds = {
SAFE_SEEK_OFFSET: 'DEMO_SAFE_SEEK_OFFSET',
SAFE_SKIP_DISTANCE: 'DEMO_SAFE_SKIP_DISTANCE',
SEGMENT_RELATIVE_VTT_TIMING: 'DEMO_SEGMENT_RELATIVE_VTT_TIMING',
SEQUENCE_MODE: 'DEMO_SEQUENCE_MODE',
SESSION_ID: 'DEMO_SESSION_ID',
SHAKA_CONTROLS: 'DEMO_SHAKA_CONTROLS',
SLOW_HALF_LIFE: 'DEMO_SLOW_HALF_LIFE',
Expand Down
4 changes: 3 additions & 1 deletion demo/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ shakaDemo.Config = class {
'manifest.hls.useSafariBehaviorForLive')
.addNumberInput_(MessageIds.LIVE_SEGMENTS_DELAY,
'manifest.hls.liveSegmentsDelay')
.addBoolInput_(MessageIds.HLS_SEQUENCE_MODE,
'manifest.hls.sequenceMode')
.addNumberInput_(MessageIds.AVAILABILITY_WINDOW_OVERRIDE,
'manifest.availabilityWindowOverride',
/* canBeDecimal= */ true,
Expand All @@ -239,7 +241,7 @@ shakaDemo.Config = class {
/* canBeDecimal= */ false,
/* canBeZero= */ false,
/* canBeUnset= */ true)
.addBoolInput_(MessageIds.SEQUENCE_MODE,
.addBoolInput_(MessageIds.DASH_SEQUENCE_MODE,
'manifest.dash.sequenceMode')
.addBoolInput_(MessageIds.DISABLE_AUDIO,
'manifest.disableAudio')
Expand Down
3 changes: 2 additions & 1 deletion demo/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"DEMO_CUSTOM_INTRO_TWO": "Press the button below to add a custom asset.",
"DEMO_DASH": "DASH",
"DEMO_DASH_IF": "DASH-IF",
"DEMO_DASH_SEQUENCE_MODE": "Enable DASH sequence mode",
"DEMO_DEFAULT_AUDIO_CODEC": "Default Audio Codec",
"DEMO_DEFAULT_PRESENTATION_DELAY": "Default Presentation Delay",
"DEMO_DEFAULT_VIDEO_CODEC": "Default Video Codec",
Expand Down Expand Up @@ -184,6 +185,7 @@
"DEMO_FAILURE_MISC": "Shaka Player failed to load! If you are using an ad blocker, try switching to compiled mode at the bottom of the page.",
"DEMO_FAILURE_NO_BROWSER_SUPPORT": "Your browser is not supported!",
"DEMO_HLS_FULL_MIME_TYPE": "Full Mime Type for Playing Media Playlists Directly",
"DEMO_HLS_SEQUENCE_MODE": "Enable HLS sequence mode",
"DEMO_PLAY": "Play",
"DEMO_PLAYREADY": "PlayReady DRM",
"DEMO_PREFER_FORCED_SUBS": "Prefer Forced Subs",
Expand All @@ -199,7 +201,6 @@
"DEMO_SAFE_SEEK_OFFSET": "Safe Seek Offset",
"DEMO_SAFE_SKIP_DISTANCE": "Safe Skip Distance",
"DEMO_SEGMENT_RELATIVE_VTT_TIMING": "Enable segment-relative VTT Timing",
"DEMO_SEQUENCE_MODE": "Enable sequence mode",
"DEMO_SESSION_ID": "Session ID",
"DEMO_SAVE_BUTTON": "Save",
"DEMO_SHAKA": "Shaka",
Expand Down
12 changes: 8 additions & 4 deletions demo/locales/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@
"description": "Text that describes an asset that comes from the Dash Industry Forum asset library.",
"message": "[PROPER_NAME:DASH-IF]"
},
"DEMO_DASH_SEQUENCE_MODE": {
"description": "The name of a configuration value.",
"message": "Enable DASH sequence mode"
},
"DEMO_DEFAULT_AUDIO_CODEC": {
"description": "The name of a configuration value.",
"message": "Default Audio Codec"
Expand Down Expand Up @@ -379,6 +383,10 @@
"description": "Text that describes an asset that is packaged in an HLS manifest.",
"message": "[PROPER_NAME:HLS]"
},
"DEMO_HLS_SEQUENCE_MODE": {
"description": "The name of a configuration value.",
"message": "Enable HLS sequence mode"
},
"DEMO_HLS_TAB": {
"description": "The header for a tab within the custom asset creation dialog.",
"message": "[PROPER_NAME:HLS]"
Expand Down Expand Up @@ -803,10 +811,6 @@
"description": "The name of a configuration value.",
"message": "Enable segment-relative VTT Timing"
},
"DEMO_SEQUENCE_MODE": {
"description": "The name of a configuration value.",
"message": "Enable sequence mode"
},
"DEMO_SESSION_ID": {
"description": "The name of a configuration value.",
"message": "Session ID"
Expand Down
6 changes: 5 additions & 1 deletion externs/shaka/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
* imageStreams: !Array.<shaka.extern.Stream>,
* offlineSessionIds: !Array.<string>,
* minBufferTime: number,
* sequenceMode: boolean
* sequenceMode: boolean,
* type: string
* }}
*
* @description
Expand Down Expand Up @@ -76,6 +77,9 @@
* @property {boolean} sequenceMode
* If true, we will append the media segments using sequence mode; that is to
* say, ignoring any timestamps inside the media files.
* @property {string} type
* Indicates the type of the manifest. It can be <code>'HLS'</code> or
* <code>'DASH'</code>.
*
* @exportDoc
*/
Expand Down
6 changes: 5 additions & 1 deletion externs/shaka/offline.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ shaka.extern.StoredContent;
* drmInfo: ?shaka.extern.DrmInfo,
* appMetadata: Object,
* isIncomplete: (boolean|undefined),
* sequenceMode: (boolean|undefined)
* sequenceMode: (boolean|undefined),
* type: (string|undefined)
* }}
*
* @property {number} creationTime
Expand Down Expand Up @@ -102,6 +103,9 @@ shaka.extern.StoredContent;
* @property {(boolean|undefined)} sequenceMode
* If true, we will append the media segments using sequence mode; that is to
* say, ignoring any timestamps inside the media files.
* @property {(string|undefined)} type
* Indicates the type of the manifest. It can be <code>'HLS'</code> or
* <code>'DASH'</code>.
*/
shaka.extern.ManifestDB;

Expand Down
12 changes: 9 additions & 3 deletions externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,13 @@ shaka.extern.MetadataRawFrame;
/**
* @typedef {{
* key: string,
* data: (ArrayBuffer|string),
* data: (ArrayBuffer|string|number),
* description: string
* }}
*
* @description metadata frame parsed.
* @property {string} key
* @property {ArrayBuffer|string} data
* @property {ArrayBuffer|string|number} data
* @property {string} description
* @exportDoc
*/
Expand Down Expand Up @@ -840,7 +840,8 @@ shaka.extern.DashManifestConfiguration;
* ignoreManifestProgramDateTime: boolean,
* mediaPlaylistFullMimeType: string,
* useSafariBehaviorForLive: boolean,
* liveSegmentsDelay: number
* liveSegmentsDelay: number,
* sequenceMode: boolean
* }}
*
* @property {boolean} ignoreTextStreamFailures
Expand Down Expand Up @@ -881,6 +882,11 @@ shaka.extern.DashManifestConfiguration;
* The default presentation delay will be calculated as a number of segments.
* This is the number of segments for this calculation..
* <i>Defaults to <code>3</code>.</i>
* @property {boolean} sequenceMode
* If true, the media segments are appended to the SourceBuffer in
* "sequence mode" (ignoring their internal timestamps).
* Defaults to <code>true</code> except on WebOS 3, Tizen 2,
* Tizen 3 and PlayStation 4 whose default value is <code>false</code>.
* @exportDoc
*/
shaka.extern.HlsManifestConfiguration;
Expand Down
1 change: 1 addition & 0 deletions lib/dash/dash_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ shaka.dash.DashParser = class {
offlineSessionIds: [],
minBufferTime: minBufferTime || 0,
sequenceMode: this.config_.dash.sequenceMode,
type: shaka.media.ManifestParser.DASH,
};

// We only need to do clock sync when we're using presentation start
Expand Down
19 changes: 8 additions & 11 deletions lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,8 @@ shaka.hls.HlsParser = class {
imageStreams,
offlineSessionIds: [],
minBufferTime: 0,
sequenceMode: true,
sequenceMode: this.config_.hls.sequenceMode,
type: shaka.media.ManifestParser.HLS,
};
this.playerInterface_.makeTextStreamsForClosedCaptions(this.manifest_);
}
Expand Down Expand Up @@ -3725,13 +3726,9 @@ shaka.hls.HlsParser.PresentationType_ = {
LIVE: 'LIVE',
};

if (!shaka.util.Platform.isTizen3() &&
!shaka.util.Platform.isTizen2() &&
!shaka.util.Platform.isWebOS3()) {
shaka.media.ManifestParser.registerParserByExtension(
'm3u8', () => new shaka.hls.HlsParser());
shaka.media.ManifestParser.registerParserByMime(
'application/x-mpegurl', () => new shaka.hls.HlsParser());
shaka.media.ManifestParser.registerParserByMime(
'application/vnd.apple.mpegurl', () => new shaka.hls.HlsParser());
}
shaka.media.ManifestParser.registerParserByExtension(
'm3u8', () => new shaka.hls.HlsParser());
shaka.media.ManifestParser.registerParserByMime(
'application/x-mpegurl', () => new shaka.hls.HlsParser());
shaka.media.ManifestParser.registerParserByMime(
'application/vnd.apple.mpegurl', () => new shaka.hls.HlsParser());
18 changes: 18 additions & 0 deletions lib/media/manifest_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,24 @@ shaka.media.ManifestParser = class {
};


/**
* @const {string}
*/
shaka.media.ManifestParser.HLS = 'HLS';


/**
* @const {string}
*/
shaka.media.ManifestParser.DASH = 'DASH';


/**
* @const {string}
*/
shaka.media.ManifestParser.UNKNOWN = 'UNKNOWN';


/**
* Contains the parser factory functions indexed by MIME type.
*
Expand Down
Loading