Skip to content

Commit

Permalink
Merge branch 'shaka-project:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Robloche authored Dec 5, 2023
2 parents d715c75 + 1af93e6 commit 00fd38e
Show file tree
Hide file tree
Showing 97 changed files with 571 additions and 180 deletions.
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
# Changelog

## [4.7.0](https://github.com/shaka-project/shaka-player/compare/v4.6.0...v4.7.0) (2023-12-04)


### Features

* Add config to allow Media Source recoveries ([#5938](https://github.com/shaka-project/shaka-player/issues/5938)) ([0deb25b](https://github.com/shaka-project/shaka-player/commit/0deb25b57f0612a802ad8fbc8e3e379dff54a57c))
* Add config to prefer spatial audio ([#5963](https://github.com/shaka-project/shaka-player/issues/5963)) ([90bc6a7](https://github.com/shaka-project/shaka-player/commit/90bc6a7c783103aaa4fca1a6284be338f9ec7301))
* add preferred video label ([#5948](https://github.com/shaka-project/shaka-player/issues/5948)) ([503327a](https://github.com/shaka-project/shaka-player/commit/503327a0e3570372d85e5cf4af62230ede35b1bf))
* Add support for Common Media Server Data (CMSD) ([#5900](https://github.com/shaka-project/shaka-player/issues/5900)) ([966b910](https://github.com/shaka-project/shaka-player/commit/966b910edcd3fea03e0276bee1f36ad859a453f6))
* Avoid streams which cannot fit into the browser's MediaSource quota ([#5937](https://github.com/shaka-project/shaka-player/issues/5937)) ([c496aaf](https://github.com/shaka-project/shaka-player/commit/c496aafaeb505851b6606f6a9567fcaae1930ac7))
* **DASH:** Add support for location in Content Steering ([#5914](https://github.com/shaka-project/shaka-player/issues/5914)) ([8f453c2](https://github.com/shaka-project/shaka-player/commit/8f453c245fd21c907109f2982c25514869ffb2e3))
* **DASH:** Handle mixed-codec variants. ([#5950](https://github.com/shaka-project/shaka-player/issues/5950)) ([24e3255](https://github.com/shaka-project/shaka-player/commit/24e32559bff6457aa8a1b356f26d83b6a320b9b2)), closes [#5961](https://github.com/shaka-project/shaka-player/issues/5961)
* **Demo:** Add field for chapters URL when adding custom content ([#5934](https://github.com/shaka-project/shaka-player/issues/5934)) ([d1bc83d](https://github.com/shaka-project/shaka-player/commit/d1bc83dd53fb596a8ff22a111c26d2331860e303))
* **Demo:** Add field for text URL when adding custom content ([#5953](https://github.com/shaka-project/shaka-player/issues/5953)) ([5c4a3a2](https://github.com/shaka-project/shaka-player/commit/5c4a3a24558c5b443f78fb4cf234a4f3a60674f1))
* **Demo:** Use MediaSession action handler in the demo ([#5927](https://github.com/shaka-project/shaka-player/issues/5927)) ([078ab36](https://github.com/shaka-project/shaka-player/commit/078ab36201946ce3f854197e7985dbdc56c6e9dc))
* expose CEA708 window position in the cue's region ([#5924](https://github.com/shaka-project/shaka-player/issues/5924)) ([2a524bf](https://github.com/shaka-project/shaka-player/commit/2a524bf51fc613b8ebddb5794524cbb3f6366d4b))
* Fix Media Source recoveries in some cases ([#5966](https://github.com/shaka-project/shaka-player/issues/5966)) ([b2a880b](https://github.com/shaka-project/shaka-player/commit/b2a880b402dd1eeef418383f7bed1a709369d8b4))
* Improve npm package size ([#5955](https://github.com/shaka-project/shaka-player/issues/5955)) ([ca28063](https://github.com/shaka-project/shaka-player/commit/ca28063427167933fc2ef198a5622610332eefbd))
* Set baseDelay to 100 by default for low latency streaming ([#5926](https://github.com/shaka-project/shaka-player/issues/5926)) ([515a4ab](https://github.com/shaka-project/shaka-player/commit/515a4ab02b15b11ee5e6873d6eaa80cfaa472482))
* **UI:** Add double tap to forward/rewind in the video ([#5943](https://github.com/shaka-project/shaka-player/issues/5943)) ([918c30b](https://github.com/shaka-project/shaka-player/commit/918c30b25ae7d193bef82de95d6e0e807426cea9))
* **UI:** Add more keyboard shortcuts ([#5942](https://github.com/shaka-project/shaka-player/issues/5942)) ([2fcc2f8](https://github.com/shaka-project/shaka-player/commit/2fcc2f8f123a5fe4c43bdebdef7c97edd7b83cb1))
* **UI:** Hide language and resolution overflow menu button if there's only one choice ([#5928](https://github.com/shaka-project/shaka-player/issues/5928)) ([628bb63](https://github.com/shaka-project/shaka-player/commit/628bb63c4c082b44f749876cf1cb8b3f06887d0b))


### Bug Fixes

* **CEA:** Fix positioning in CEA-608 ([#5925](https://github.com/shaka-project/shaka-player/issues/5925)) ([83f6f53](https://github.com/shaka-project/shaka-player/commit/83f6f5379bfaffac0166c08c0a5e038b6b5d439f))
* **DASH:** Fix bad url when specify using a full WebVTT with BaseURL ([#5954](https://github.com/shaka-project/shaka-player/issues/5954)) ([ba85ece](https://github.com/shaka-project/shaka-player/commit/ba85ece3ac4dd8d2df788f29b8a0530ba110d234))
* **DASH:** Fix false redirect detection ([#5910](https://github.com/shaka-project/shaka-player/issues/5910)) ([3a68623](https://github.com/shaka-project/shaka-player/commit/3a686239461cd2389ebb11615cd01886421a6fdd))
* **DASH:** SegmentTemplate@media not updated after change in manifest ([#5899](https://github.com/shaka-project/shaka-player/issues/5899)) ([30de177](https://github.com/shaka-project/shaka-player/commit/30de1771cf598068f5e0b446b36f07eb12676f4d))
* **Demo:** Allow configure some missing configs ([#5918](https://github.com/shaka-project/shaka-player/issues/5918)) ([c62e38c](https://github.com/shaka-project/shaka-player/commit/c62e38c6e35bdeb2b5c6ecc68c85e9b28d13e39d))
* **Demo:** Pressing "Edit" button unstores custom asset, but does not update "stored" button ([#5936](https://github.com/shaka-project/shaka-player/issues/5936)) ([82b958f](https://github.com/shaka-project/shaka-player/commit/82b958f3e4e34d2d6952f7f425d9f47a944a1e3b))
* Fix color detection in text utils ([#5970](https://github.com/shaka-project/shaka-player/issues/5970)) ([68903e1](https://github.com/shaka-project/shaka-player/commit/68903e130ec85585211d5b89ee92d6610aa6e4b3))
* Fix ESDS box parser ([#5952](https://github.com/shaka-project/shaka-player/issues/5952)) ([7683892](https://github.com/shaka-project/shaka-player/commit/76838921065d71bf31183f5a4b7ac775f24e800b))
* Fix init segment comparison ([#5920](https://github.com/shaka-project/shaka-player/issues/5920)) ([82ab893](https://github.com/shaka-project/shaka-player/commit/82ab8937e68e2a46002794d86fea1527cbba213e))
* Fix language comparison in addTextTrackAsync ([#5904](https://github.com/shaka-project/shaka-player/issues/5904)) ([f708318](https://github.com/shaka-project/shaka-player/commit/f7083183c30339e7074d7501a94fabb4ea3166df))
* Fix reset Media Source when using mixed codecs in different containers ([#5949](https://github.com/shaka-project/shaka-player/issues/5949)) ([419b1c3](https://github.com/shaka-project/shaka-player/commit/419b1c35d8c72c77fe17cb65d43d8f1c0f24f298))
* Fix trackschanged event not fired after a license request is denied for some tracks ([#5962](https://github.com/shaka-project/shaka-player/issues/5962)) ([4eba182](https://github.com/shaka-project/shaka-player/commit/4eba182826e71040dd2ed55072ecc1a4704ce536))
* Fix transmuxer when sample has no video data ([#5933](https://github.com/shaka-project/shaka-player/issues/5933)) ([6102060](https://github.com/shaka-project/shaka-player/commit/610206002838157658bdadb608588c4430cf075d))
* **HLS:** Fix m4s extension detection ([#5951](https://github.com/shaka-project/shaka-player/issues/5951)) ([d89945f](https://github.com/shaka-project/shaka-player/commit/d89945fc78ed671caabb6d8a5a8134630d5f89b4))
* **HLS:** Provide a fallback to GET request when HEAD request fails ([#5964](https://github.com/shaka-project/shaka-player/issues/5964)) ([fb5a833](https://github.com/shaka-project/shaka-player/commit/fb5a833df86a03d9f282f37fb2a3a61e61fa9c84))
* **HLS:** Recognize CEA subtitles when CLOSED-CAPTIONS attribute is missing ([#5916](https://github.com/shaka-project/shaka-player/issues/5916)) ([58d4597](https://github.com/shaka-project/shaka-player/commit/58d45976d83d5a2b63bf1c1a2defa018fc5c5d8c))
* Only append to the buffer init segments when the segment is independent ([#5921](https://github.com/shaka-project/shaka-player/issues/5921)) ([09f2a2e](https://github.com/shaka-project/shaka-player/commit/09f2a2e887459a534d13a7b0a9c3d65c77c4a403))
* Properly size region anchor from LINE units ([#5941](https://github.com/shaka-project/shaka-player/issues/5941)) ([8b6602e](https://github.com/shaka-project/shaka-player/commit/8b6602ec7c82717a56b672e5c2697856eab44ad2))
* **UI:** Correctly display video time and duration for VOD ([#5929](https://github.com/shaka-project/shaka-player/issues/5929)) ([00ff864](https://github.com/shaka-project/shaka-player/commit/00ff864c2c948de611ab8959e35194e5d356a751))
* Unmask errors on LL ([#5908](https://github.com/shaka-project/shaka-player/issues/5908)) ([c898364](https://github.com/shaka-project/shaka-player/commit/c8983646c1d3d1721ed86a5d8376dea84835ad63))
* **WebVTT:** Fix support for line vertical alignment ([#5945](https://github.com/shaka-project/shaka-player/issues/5945)) ([9f5e461](https://github.com/shaka-project/shaka-player/commit/9f5e46190ca00b1df36d5210852962bb52aac0c4))

## [4.6.0](https://github.com/shaka-project/shaka-player/compare/v4.5.0...v4.6.0) (2023-11-16)


Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ DASH features supported:
- Trick mode tracks
- WebVTT and TTML
- CEA-608/708 captions
- Multi-codec variants (on platforms with changeType support)

DASH features **not** supported:
- Xlink with actuate=onRequest
Expand Down
1 change: 0 additions & 1 deletion demo/common/asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

/**
* @fileoverview
* @suppress {missingRequire}
*/

goog.provide('ShakaDemoAssetInfo');
Expand Down
1 change: 0 additions & 1 deletion demo/common/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

/**
* @fileoverview
* @suppress {missingRequire}
*/

goog.require('ShakaDemoAssetInfo');
Expand Down
2 changes: 2 additions & 0 deletions demo/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ shakaDemo.Config = class {
'manifest.dash.ignoreEmptyAdaptationSet')
.addBoolInput_('Ignore DASH maxSegmentDuration',
'manifest.dash.ignoreMaxSegmentDuration')
.addBoolInput_('Allow DASH multi type variants',
'manifest.dash.multiTypeVariantsAllowed')
.addBoolInput_('Ignore HLS Text Stream Failures',
'manifest.hls.ignoreTextStreamFailures')
.addBoolInput_('Ignore HLS Image Stream Failures',
Expand Down
4 changes: 3 additions & 1 deletion docs/tutorials/ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,13 @@ constructor.
// "local" because it is for local playback only, as opposed to the player proxy
// object, which will route your calls to the ChromeCast receiver as necessary.
const localPlayer = new shaka.Player();
await localPlayer.attach(videoElement);
// "Overlay" because the UI will add DOM elements inside the container,
// to visually overlay the video element
const ui = new shaka.ui.Overlay(localPlayer, videoContainerElement,
videoElement);
// Now that the player has been configured to be part of a UI, attach it to the
// video.
await localPlayer.attach(videoElement);
// As with DOM-based setup, get access to the UI controls and player from the
// UI.
Expand Down
13 changes: 12 additions & 1 deletion externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,8 @@ shaka.extern.InitDataTransform;
* keySystemsByURI: !Object.<string, string>,
* manifestPreprocessor: function(!Element),
* sequenceMode: boolean,
* enableAudioGroups: boolean
* enableAudioGroups: boolean,
* multiTypeVariantsAllowed: boolean
* }}
*
* @property {string} clockSyncUri
Expand Down Expand Up @@ -917,6 +918,16 @@ shaka.extern.InitDataTransform;
* If set, audio streams will be grouped and filtered by their parent
* adaptation set ID.
* <i>Defaults to <code>false</code>.</i>
* @property {boolean} multiTypeVariantsAllowed
* If true, the manifest parser will create variants that have multiple
* mimeTypes or codecs for video or for audio if there is no other choice.
* Meant for content where some periods are only available in one mimeType or
* codec, and other periods are only available in a different mimeType or
* codec. For example, a stream with baked-in ads where the audio codec does
* not match the main content.
* Might result in undesirable behavior if mediaSource.codecSwitchingStrategy
* is not set to SMOOTH.
* Defaults to true if SMOOTH codec switching is supported, RELOAD overwise.
* @exportDoc
*/
shaka.extern.DashManifestConfiguration;
Expand Down
4 changes: 4 additions & 0 deletions lib/ads/client_side_ad_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ goog.provide('shaka.ads.ClientSideAdManager');

goog.require('goog.asserts');
goog.require('shaka.ads.ClientSideAd');
goog.require('shaka.log');
goog.require('shaka.util.Dom');
goog.require('shaka.util.EventManager');
goog.require('shaka.util.FakeEvent');
goog.require('shaka.util.IReleasable');

/**
Expand Down
5 changes: 5 additions & 0 deletions lib/ads/media_tailor_ad_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ goog.require('goog.asserts');
goog.require('shaka.ads.MediaTailorAd');
goog.require('shaka.log');
goog.require('shaka.net.NetworkingEngine');
goog.require('goog.Uri');
goog.require('shaka.util.EventManager');
goog.require('shaka.util.Error');
goog.require('shaka.util.FakeEvent');
goog.require('shaka.util.IReleasable');
goog.require('shaka.util.PublicPromise');
goog.require('shaka.util.StringUtils');


Expand Down
4 changes: 4 additions & 0 deletions lib/ads/server_side_ad_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ goog.provide('shaka.ads.ServerSideAdManager');
goog.require('goog.asserts');
goog.require('shaka.ads.ServerSideAd');
goog.require('shaka.log');
goog.require('shaka.util.EventManager');
goog.require('shaka.util.Error');
goog.require('shaka.util.FakeEvent');
goog.require('shaka.util.IReleasable');
goog.require('shaka.util.PublicPromise');


/**
Expand Down
5 changes: 5 additions & 0 deletions lib/dash/dash_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ goog.require('shaka.dash.SegmentBase');
goog.require('shaka.dash.SegmentList');
goog.require('shaka.dash.SegmentTemplate');
goog.require('shaka.log');
goog.require('shaka.media.Capabilities');
goog.require('shaka.media.ManifestParser');
goog.require('shaka.media.PresentationTimeline');
goog.require('shaka.media.SegmentIndex');
Expand Down Expand Up @@ -134,6 +135,10 @@ shaka.dash.DashParser = class {
if (this.contentSteeringManager_) {
this.contentSteeringManager_.configure(this.config_);
}

this.periodCombiner_.setAllowMultiTypeVariants(
this.config_.dash.multiTypeVariantsAllowed &&
shaka.media.Capabilities.isChangeTypeSupported());
}

/**
Expand Down
3 changes: 0 additions & 3 deletions lib/media/drm_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -2038,9 +2038,6 @@ shaka.media.DrmEngine = class {

for (const drm1 of drms1) {
for (const drm2 of drms2) {
// This method is only called to compare drmInfos of a video and an
// audio adaptations, so we shouldn't have to worry about checking
// robustness.
if (drm1.keySystem == drm2.keySystem) {
const initDataMap = new Map();
const bothInitDatas = (drm1.initData || [])
Expand Down
52 changes: 34 additions & 18 deletions lib/media/media_source_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ shaka.media.MediaSourceEngine = class {
const calculatedTimestampOffset = reference.startTime - timestamp;
const timestampOffsetDifference =
Math.abs(timestampOffset - calculatedTimestampOffset);
if ((timestampOffsetDifference >= 0.1 || seeked || adaptation) &&
if ((timestampOffsetDifference >= 0.001 || seeked || adaptation) &&
(!isChunkedData || calculatedTimestampOffset > 0 ||
!timestampOffset)) {
timestampOffset = calculatedTimestampOffset;
Expand Down Expand Up @@ -1091,7 +1091,8 @@ shaka.media.MediaSourceEngine = class {
* value will be dropped.
* @param {boolean} ignoreTimestampOffset If true, the timestampOffset will
* not be applied in this step.
* @param {shaka.extern.Stream} stream The current stream.
* @param {string} mimeType
* @param {string} codecs
* @param {!Map.<shaka.util.ManifestParserUtils.ContentType,
* shaka.extern.Stream>} streamsByType
* A map of content types to streams. All streams must be supported
Expand All @@ -1101,7 +1102,7 @@ shaka.media.MediaSourceEngine = class {
*/
async setStreamProperties(
contentType, timestampOffset, appendWindowStart, appendWindowEnd,
ignoreTimestampOffset, stream, streamsByType) {
ignoreTimestampOffset, mimeType, codecs, streamsByType) {
const ContentType = shaka.util.ManifestParserUtils.ContentType;
if (contentType == ContentType.TEXT) {
if (!ignoreTimestampOffset) {
Expand All @@ -1112,8 +1113,8 @@ shaka.media.MediaSourceEngine = class {
}
const operations = [];

const hasChangedCodecs =
await this.codecSwitchIfNecessary_(contentType, stream, streamsByType);
const hasChangedCodecs = await this.codecSwitchIfNecessary_(
contentType, mimeType, codecs, streamsByType);

if (!hasChangedCodecs) {
// Queue an abort() to help MSE splice together overlapping segments.
Expand Down Expand Up @@ -1827,15 +1828,17 @@ shaka.media.MediaSourceEngine = class {
* Codec switch if necessary, this will not resolve until the codec
* switch is over.
* @param {shaka.util.ManifestParserUtils.ContentType} contentType
* @param {shaka.extern.Stream} stream
* @param {string} mimeType
* @param {string} codecs
* @param {!Map.<shaka.util.ManifestParserUtils.ContentType,
* shaka.extern.Stream>} streamsByType
* @return {!Promise.<boolean>} true if there was a codec switch,
* false otherwise.
* @private
*/
async codecSwitchIfNecessary_(contentType, stream, streamsByType) {
if (contentType == shaka.util.ManifestParserUtils.ContentType.TEXT) {
async codecSwitchIfNecessary_(contentType, mimeType, codecs, streamsByType) {
const ContentType = shaka.util.ManifestParserUtils.ContentType;
if (contentType == ContentType.TEXT) {
return false;
}
const MimeUtils = shaka.util.MimeUtils;
Expand All @@ -1846,30 +1849,43 @@ shaka.media.MediaSourceEngine = class {

/** @type {?shaka.extern.Transmuxer} */
let transmuxer;
let newMimeType = shaka.util.MimeUtils.getFullType(
stream.mimeType, stream.codecs);
let transmuxerMuxed = false;
let newMimeType = shaka.util.MimeUtils.getFullType(mimeType, codecs);
let needTransmux = this.config_.forceTransmux;
if (!shaka.media.Capabilities.isTypeSupported(newMimeType) ||
(!this.sequenceMode_ &&
shaka.util.MimeUtils.RAW_FORMATS.includes(newMimeType))) {
needTransmux = true;
}
const newMimeTypeWithAllCodecs =
shaka.util.MimeUtils.getFullTypeWithAllCodecs(
stream.mimeType, stream.codecs);
const TransmuxerEngine = shaka.transmuxer.TransmuxerEngine;
if (needTransmux) {
const newMimeTypeWithAllCodecs =
shaka.util.MimeUtils.getFullTypeWithAllCodecs(mimeType, codecs);
const transmuxerPlugin =
TransmuxerEngine.findTransmuxer(newMimeTypeWithAllCodecs);
if (transmuxerPlugin) {
transmuxer = transmuxerPlugin();
newMimeType =
transmuxer.convertCodecs(contentType, newMimeTypeWithAllCodecs);
const audioCodec = shaka.util.ManifestParserUtils.guessCodecsSafe(
ContentType.AUDIO, (codecs || '').split(','));
const videoCodec = shaka.util.ManifestParserUtils.guessCodecsSafe(
ContentType.VIDEO, (codecs || '').split(','));
if (audioCodec && videoCodec) {
transmuxerMuxed = true;
let codec = videoCodec;
if (contentType == ContentType.AUDIO) {
codec = audioCodec;
}
newMimeType = transmuxer.convertCodecs(contentType,
shaka.util.MimeUtils.getFullTypeWithAllCodecs(mimeType, codec));
} else {
newMimeType =
transmuxer.convertCodecs(contentType, newMimeTypeWithAllCodecs);
}
}
}

const newAllCodecs = MimeUtils.getCodecs(newMimeType);
const newCodec = MimeUtils.getCodecBase(newAllCodecs);
const newCodec = MimeUtils.getCodecBase(
MimeUtils.getCodecs(newMimeType));
const newBasicType = MimeUtils.getBasicType(newMimeType);

// Current/new codecs base and basic type match then no need to switch
Expand All @@ -1878,7 +1894,7 @@ shaka.media.MediaSourceEngine = class {
}

let allowChangeType = true;
if (this.needSplitMuxedContent_ || (newAllCodecs.split(',').length &&
if (this.needSplitMuxedContent_ || (transmuxerMuxed &&
transmuxer && !this.transmuxers_[contentType])) {
allowChangeType = false;
}
Expand Down
Loading

0 comments on commit 00fd38e

Please sign in to comment.