Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into noMoStateEngineBranch
  • Loading branch information
theodab committed Oct 26, 2023
2 parents 8642a0a + 7e94c48 commit 0b2fca6
Show file tree
Hide file tree
Showing 70 changed files with 1,934 additions and 620 deletions.
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Alugha GmbH <*@alugha.com>
Alvaro Velad Galvan <ladvan91@hotmail.com>
Amila Sampath <lucksy@gmail.com>
Anthony Stansbridge <github@anthonystansbridge.co.uk>
Armand Zangue <armand.zangue@gmail.com>
Benjamin Wallberg <me@bwallberg.com>
Bonnier Broadcasting <*@bonnierbroadcasting.com>
Bryan Huh <bhh1988@gmail.com>
Expand All @@ -41,6 +42,7 @@ Gil Gonen <gil.gonen@gmail.com>
Giorgio Gamberoni <giorgio.gamberoni@gmail.com>
Giuseppe Samela <giuseppe.samela@gmail.com>
Google Inc. <*@google.com>
Ivan Kohut <i.kohut@yahoo.com>
Itay Kinnrot <Itay.Kinnrot@Kaltura.com>
Jaeseok Lee <devsunb@gmail.com>
Jason Palmer <jason@jason-palmer.com>
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Alvaro Velad Galvan <ladvan91@hotmail.com>
Amila Sampath <lucksy@gmail.com>
Andy Hochhaus <ahochhaus@samegoal.com>
Anthony Stansbridge <github@anthonystansbridge.co.uk>
Armand Zangue <armand.zangue@gmail.com>
Ashutosh Kumar Mukhiya <ashukm4@gmail.com>
Benjamin Wallberg <benjamin.wallberg@bonnierbroadcasting.com>
Benjamin Wallberg <me@bwallberg.com>
Expand Down Expand Up @@ -59,6 +60,7 @@ Gil Gonen <gil.gonen@gmail.com>
Giorgio Gamberoni <giorgio.gamberoni@gmail.com>
Giuseppe Samela <giuseppe.samela@gmail.com>
Hichem Taoufik <hichem@code-it.fr>
Ivan Kohut <i.kohut@yahoo.com>
Itay Kinnrot <itay.kinnrot@kaltura.com>
Isaac Ramirez <isaac.ramirez.herrera@gmail.com>
Jacob Trimble <modmaker@google.com>
Expand Down
3 changes: 2 additions & 1 deletion build/types/core
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
+../../lib/media/stall_detector.js
+../../lib/media/streaming_engine.js
+../../lib/media/segment_prefetch.js
+../../lib/media/segment_utils.js
+../../lib/media/time_ranges_utils.js
+../../lib/media/video_wrapper.js
+../../lib/media/webm_segment_index_parser.js
Expand All @@ -57,6 +58,7 @@

+../../lib/text/cue.js
+../../lib/text/simple_text_displayer.js
+../../lib/text/stub_text_displayer.js
+../../lib/text/text_engine.js
+../../lib/text/text_utils.js
+../../lib/text/ui_text_displayer.js
Expand Down Expand Up @@ -104,7 +106,6 @@
+../../lib/util/player_configuration.js
+../../lib/util/pssh.js
+../../lib/util/public_promise.js
+../../lib/util/segment_utils.js
+../../lib/util/state_history.js
+../../lib/util/stats.js
+../../lib/util/stream_utils.js
Expand Down
19 changes: 19 additions & 0 deletions demo/common/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,25 @@ shakaAssets.testAssets = [
.addFeature(shakaAssets.Feature.MP4)
.addFeature(shakaAssets.Feature.THUMBNAILS)
.addExtraThumbnail('https://cdn.bitmovin.com/content/assets/art-of-motion-dash-hls-progressive/thumbnails/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.vtt'),
new ShakaDemoAssetInfo(
/* name= */ 'Art of Motion (HLS) (external thumbnails)',
/* iconUri= */ 'https://storage.googleapis.com/shaka-asset-icons/art_of_motion.png',
/* manifestUri= */ 'https://cdn.bitmovin.com/content/assets/art-of-motion-dash-hls-progressive/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8',
/* source= */ shakaAssets.Source.BITCODIN)
.addFeature(shakaAssets.Feature.HLS)
.addFeature(shakaAssets.Feature.HIGH_DEFINITION)
.addFeature(shakaAssets.Feature.MP2TS)
.addFeature(shakaAssets.Feature.THUMBNAILS)
.addExtraThumbnail('https://cdn.bitmovin.com/content/assets/art-of-motion-dash-hls-progressive/thumbnails/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.vtt'),
new ShakaDemoAssetInfo(
/* name= */ 'Art of Motion (MP4) (external thumbnails)',
/* iconUri= */ 'https://storage.googleapis.com/shaka-asset-icons/art_of_motion.png',
/* manifestUri= */ 'https://cdn.bitmovin.com/content/assets/art-of-motion-dash-hls-progressive/MI201109210084_mpeg-4_hd_high_1080p25_10mbits.mp4',
/* source= */ shakaAssets.Source.BITCODIN)
.addFeature(shakaAssets.Feature.HIGH_DEFINITION)
.addFeature(shakaAssets.Feature.MP4)
.addFeature(shakaAssets.Feature.THUMBNAILS)
.addExtraThumbnail('https://cdn.bitmovin.com/content/assets/art-of-motion-dash-hls-progressive/thumbnails/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.vtt'),
// End bitcodin assets }}}

// MetaCDN assets {{{
Expand Down
15 changes: 15 additions & 0 deletions demo/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ shakaDemo.Config = class {
.addBoolInput_('Enable HLS sequence mode', 'manifest.hls.sequenceMode')
.addBoolInput_('Ignore Manifest Timestamps in Segments Mode',
'manifest.hls.ignoreManifestTimestampsInSegmentsMode')
.addBoolInput_('Disable codec guessing',
'manifest.hls.disableCodecGuessing')
.addNumberInput_('Availability Window Override',
'manifest.availabilityWindowOverride',
/* canBeDecimal= */ true,
Expand Down Expand Up @@ -436,6 +438,19 @@ shakaDemo.Config = class {
this.addSelectInput_('Preferred HDR Level', 'preferredVideoHdrLevel',
hdrLevels, hdrLevelNames);

const videoLayouts = {
'': '',
'CH-STEREO': 'CH-STEREO',
'CH-MONO': 'CH-MONO',
};
const videoLayoutsNames = {
'CH-STEREO': 'Stereoscopic',
'CH-MONO': 'Monoscopic',
'': 'No Preference',
};
this.addSelectInput_('Preferred video layout', 'preferredVideoLayout',
videoLayouts, videoLayoutsNames);

this.addBoolInput_('Start At Segment Boundary',
'streaming.startAtSegmentBoundary')
.addBoolInput_('Ignore Text Stream Failures',
Expand Down
19 changes: 18 additions & 1 deletion demo/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,21 @@ shakaDemo.Custom = class {
this.makeField_(
container, manifestTypeName, manifestTypeSetup, manifestTypeChange);

// Make the MediaTailor URL field.
const mediaTailorSetup = (input, container) => {
if (assetInProgress.mediaTailorUrl) {
input.value = assetInProgress.mediaTailorUrl;
}
};
const mediaTailorOnChange = (input) => {
assetInProgress.setMediaTailor(input.value);
this.manifestField_.required =
this.checkManifestRequired_(assetInProgress);
};
const mediaTailorName = 'Media Tailor URL';
this.makeField_(
container, mediaTailorName, mediaTailorSetup, mediaTailorOnChange);

return adsDiv;
}

Expand Down Expand Up @@ -625,7 +640,9 @@ shakaDemo.Custom = class {
// from the Google Ad Manager using IMA ids.
const isDaiAdManifest = (assetInProgress.imaContentSrcId &&
assetInProgress.imaVideoId) || assetInProgress.imaAssetKey != null;
return !isDaiAdManifest;
// Or if we are getting it from AWS Elemental MediaTailor.
const isMediaTailor = !!assetInProgress.mediaTailorUrl;
return !isDaiAdManifest && !isMediaTailor;
}

/**
Expand Down
54 changes: 54 additions & 0 deletions docs/tutorials/ad_monetization.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,60 @@ other ad providers in v3.1+.
Please note that the current API is likely to undergo significant
changes as our support extends.

#### AWS Elemental MediaTailor Integration

Shaka Player provides an integration with the [AWS Elemental MediaTailor][].
We support Client Side, Server Side and overlays ad insertion.

[AWS Elemental MediaTailor]: https://aws.amazon.com/mediatailor/

All ad insertion experiences are available through the
{@linksource shaka.extern.IAdManager} object on the Player.

If you're not using Shaka's UI library, you will
also need to create a `<div>` over your video element to serve as an ad
container.

Start by initializing the server side logic.
With Shaka UI:

```js
const video = document.getElementById('video');
const ui = video['ui'];
const controls = video.ui.getControls();
// If you're using a non-UI build, this is the div you'll need to create
// for your layout.
const container = controls.getServerSideAdContainer();
const player = controls.getPlayer();
const netEngine = player.getNetworkingEngine();
const adManager = player.getAdManager();
adManager.initMediaTailor(container, netEngine, video);
```

Requesting a Client Side stream:

```js
const mediaTailorUrl = 'https://d305rncpy6ne2q.cloudfront.net/v1/session/94063eadf7d8c56e9e2edd84fdf897826a70d0df/SFP-MediaTailor-VOD-HLS-DASH/out/v1/b94f3611978f419985a18335bac9d9cb/ddb73bf548a44551a0059c346226445a/eaa5485198bf497284559efb8172425e/index.mpd';
const mediaTailorAdsParams = {
adsParams: {
assetid: 'test2',
podduration: '15',
},
};
const uri = await adManager.requestMediaTailorStream(mediaTailorUrl, mediaTailorAdsParams);
player.load(uri);
```

Requesting a Server Side stream:

```js
const mediaTailorUrl = 'https://ad391cc0d55b44c6a86d232548adc225.mediatailor.us-east-1.amazonaws.com/v1/session/d02fedbbc5a68596164208dd24e9b48aa60dadc7/singssai/master.m3u8';
const uri = await adManager.requestMediaTailorStream(mediaTailorUrl);
player.load(uri);
```

Note: overlays ad insertions is the same as server side.

#### IMA SDK Integration

Shaka Player provides an integration with the [Interactive Media Ads][] SDKs.
Expand Down
24 changes: 24 additions & 0 deletions externs/managedmediasource.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*! @license
* Shaka Player
* Copyright 2016 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

/**
* @fileoverview Externs for ManagedMediaSource which were missing in the
* Closure compiler.
*
* @externs
*/

/**
* @constructor
* @extends {MediaSource}
*/
function ManagedMediaSource() {}

/**
* @param {string} type
* @return {boolean}
*/
ManagedMediaSource.isTypeSupported = function(type) {};
7 changes: 7 additions & 0 deletions externs/shaka/cea.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ shaka.extern.ICaptionDecoder = class {
* @exportDoc
*/
clear() {}

/**
* Returns the streams that the CEA decoder found.
* @return {!Array.<string>}
* @exportDoc
*/
getStreams() {}
};

/**
Expand Down
7 changes: 6 additions & 1 deletion externs/shaka/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ shaka.extern.FetchCryptoKeysFunction;
* frameRate: (number|undefined),
* pixelAspectRatio: (string|undefined),
* hdr: (string|undefined),
* videoLayout: (string|undefined),
* bandwidth: (number|undefined),
* width: (number|undefined),
* height: (number|undefined),
Expand Down Expand Up @@ -434,6 +435,9 @@ shaka.extern.FetchCryptoKeysFunction;
* @property {(string|undefined)} hdr
* <i>Video streams only.</i> <br>
* The Stream's HDR info
* @property {(string|undefined)} videoLayout
* <i>Video streams only.</i> <br>
* The Stream's video layout info.
* @property {(number|undefined)} bandwidth
* <i>Audio and video streams only.</i> <br>
* The stream's required bandwidth in bits per second.
Expand Down Expand Up @@ -503,7 +507,8 @@ shaka.extern.FetchCryptoKeysFunction;
* A map containing the description of closed captions, with the caption
* channel number (CC1 | CC2 | CC3 | CC4) as the key and the language code
* as the value. If the channel number is not provided by the description,
* we'll set an 0-based index as the key.
* we'll set a 0-based index as the key. If the language code is not
* provided by the description we'll set the same value as channel number.
* Example: {'CC1': 'eng'; 'CC3': 'swe'}, or {'1', 'eng'; '2': 'swe'}, etc.
* @property {(string|undefined)} tilesLayout
* <i>Image streams only.</i> <br>
Expand Down
8 changes: 8 additions & 0 deletions externs/shaka/manifest_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ shaka.extern.ManifestParser = class {
* @exportDoc
*/
onExpirationUpdated(sessionId, expiration) {}

/**
* Tell the parser that the initial variant has been chosen.
*
* @param {shaka.extern.Variant} variant
* @exportDoc
*/
onInitialVariantChosen(variant) {}
};


Expand Down
6 changes: 5 additions & 1 deletion externs/shaka/offline.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ shaka.extern.ManifestDB;
* frameRate: (number|undefined),
* pixelAspectRatio: (string|undefined),
* hdr: (string|undefined),
* videoLayout: (string|undefined),
* kind: (string|undefined),
* language: string,
* originalLanguage: (?string|undefined),
Expand Down Expand Up @@ -164,6 +165,8 @@ shaka.extern.ManifestDB;
* The Stream's pixel aspect ratio
* @property {(string|undefined)} hdr
* The Stream's HDR info
* @property {(string|undefined)} videoLayout
* The Stream's video layout info.
* @property {(string|undefined)} kind
* The kind of text stream; undefined for audio/video.
* @property {string} language
Expand Down Expand Up @@ -199,7 +202,8 @@ shaka.extern.ManifestDB;
* A map containing the description of closed captions, with the caption
* channel number (CC1 | CC2 | CC3 | CC4) as the key and the language code
* as the value. If the channel number is not provided by the description,
* we'll set an 0-based index as the key.
* we'll set a 0-based index as the key. If the language code is not
* provided by the description we'll set the same value as channel number.
* Example: {'CC1': 'eng'; 'CC3': 'swe'}, or {'1', 'eng'; '2': 'swe'}, etc.
* @property {(string|undefined)} tilesLayout
* The value is a grid-item-dimension consisting of two positive decimal
Expand Down
20 changes: 19 additions & 1 deletion externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ shaka.extern.BufferedInfo;
* frameRate: ?number,
* pixelAspectRatio: ?string,
* hdr: ?string,
* videoLayout: ?string,
* mimeType: ?string,
* audioMimeType: ?string,
* videoMimeType: ?string,
Expand Down Expand Up @@ -280,6 +281,8 @@ shaka.extern.BufferedInfo;
* The video pixel aspect ratio provided in the manifest, if present.
* @property {?string} hdr
* The video HDR provided in the manifest, if present.
* @property {?string} videoLayout
* The video layout provided in the manifest, if present.
* @property {?string} mimeType
* The MIME type of the content provided in the manifest.
* @property {?string} audioMimeType
Expand Down Expand Up @@ -920,7 +923,8 @@ shaka.extern.DashManifestConfiguration;
* useSafariBehaviorForLive: boolean,
* liveSegmentsDelay: number,
* sequenceMode: boolean,
* ignoreManifestTimestampsInSegmentsMode: boolean
* ignoreManifestTimestampsInSegmentsMode: boolean,
* disableCodecGuessing: boolean
* }}
*
* @property {boolean} ignoreTextStreamFailures
Expand Down Expand Up @@ -973,6 +977,13 @@ shaka.extern.DashManifestConfiguration;
* to the SourceBuffer, even if the manifest and segment times disagree.
* Only applies when sequenceMode is <code>false</code>.
* <i>Defaults to <code>false</code>.</i>
* @property {boolean} disableCodecGuessing
* If set to true, the HLS parser won't automatically guess or assume default
* codec for playlists with no "CODECS" attribute. Instead, it will attempt to
* extract the missing information from the media segment.
* As a consequence, lazy-loading media playlists won't be possible for this
* use case, which may result in longer video startup times.
* <i>Defaults to <code>false</code>.</i>
* @exportDoc
*/
shaka.extern.HlsManifestConfiguration;
Expand Down Expand Up @@ -1529,6 +1540,7 @@ shaka.extern.OfflineConfiguration;
* preferredAudioCodecs: !Array.<string>,
* preferredAudioChannelCount: number,
* preferredVideoHdrLevel: string,
* preferredVideoLayout: string,
* preferredDecodingAttributes: !Array.<string>,
* preferForcedSubs: boolean,
* restrictions: shaka.extern.Restrictions,
Expand Down Expand Up @@ -1589,6 +1601,12 @@ shaka.extern.OfflineConfiguration;
* Defaults to 'AUTO'.
* Note that one some platforms, such as Chrome, attempting to play PQ content
* may cause problems.
* @property {string} preferredVideoLayout
* The preferred video layout of the video.
* Can be 'CH-STEREO', 'CH-MONO', or '' for no preference.
* If the content is predominantly stereoscopic you should use 'CH-STEREO'.
* If the content is predominantly monoscopic you should use 'CH-MONO'.
* Defaults to ''.
* @property {!Array.<string>} preferredDecodingAttributes
* The list of preferred attributes of decodingInfo, in the order of their
* priorities.
Expand Down
Loading

0 comments on commit 0b2fca6

Please sign in to comment.