Skip to content

Commit

Permalink
feat(MSS): Add support for Microsoft Smooth Streaming (VOD only) (sha…
Browse files Browse the repository at this point in the history
…ka-project#5002)

Closes shaka-project#703

---------

Co-authored-by: Joey Parrish <joeyparrish@google.com>
  • Loading branch information
avelad and joeyparrish committed Mar 24, 2023
1 parent 58aa45f commit f80bf20
Show file tree
Hide file tree
Showing 44 changed files with 3,831 additions and 82 deletions.
32 changes: 32 additions & 0 deletions LICENSE
Expand Up @@ -225,3 +225,35 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-----

Contains code from https://github.com/Dash-Industry-Forum/dash.js
(See lib/mss/mss_utils.js and lib/transmuxer/mss_transmuxer.js)

dash.js BSD License Agreement

Copyright 2015 Dash Industry Forum

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of the Dash Industry Forum nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 changes: 21 additions & 3 deletions README.md
@@ -1,9 +1,9 @@
# ![Shaka Player](docs/shaka-player-logo.png)

Shaka Player is an open-source JavaScript library for adaptive media. It plays
adaptive media formats (such as [DASH][] and [HLS][]) in a browser, without
using plugins or Flash. Instead, Shaka Player uses the open web standards
[MediaSource Extensions][] and [Encrypted Media Extensions][].
adaptive media formats (such as [DASH][], [HLS][] and [MSS][]) in a browser,
without using plugins or Flash. Instead, Shaka Player uses the open web
standards [MediaSource Extensions][] and [Encrypted Media Extensions][].

Shaka Player also supports [offline storage and playback][] of media using
[IndexedDB][]. Content can be stored on any browser. Storage of licenses
Expand All @@ -18,6 +18,7 @@ For details on what's coming next, see our [development roadmap](roadmap.md).

[DASH]: http://dashif.org/
[HLS]: https://developer.apple.com/streaming/
[MSS]: https://learn.microsoft.com/en-us/iis/media/smooth-streaming/smooth-streaming-transport-protocol
[MediaSource Extensions]: https://www.w3.org/TR/media-source/
[Encrypted Media Extensions]: https://www.w3.org/TR/encrypted-media/
[IndexedDB]: https://www.w3.org/TR/IndexedDB-2/
Expand Down Expand Up @@ -84,6 +85,7 @@ supported. This supports both DASH and HLS manifests.
|:----:|:-------------:|:---:|:---:|:-------------------:|
|DASH |**Y** |**Y**| - |**Y** |
|HLS |**Y** |**Y**|**Y**| - |
|MSS |**Y** | - | - | - |

You can also create a [manifest parser plugin][] to support custom manifest
formats.
Expand Down Expand Up @@ -159,6 +161,20 @@ HLS features **not** supported:
[MPEG-5 Part2 LCEVC]: https://www.lcevc.org


## MSS features

MSS features supported:
- VOD
- AAC and H.264
- Encrypted content (PlayReady)
- TTML/DFXP
- Only supported with [codem-isoboxer][]

MSS features **not** supported:
- Live

[codem-isoboxer]: https://github.com/Dash-Industry-Forum/codem-isoboxer

## DRM support matrix

|Browser |Widevine |PlayReady|FairPlay |ClearKey⁶ |
Expand Down Expand Up @@ -196,6 +212,7 @@ NOTES:
|:--------:|:--------:|:-------:|:-------:|:--------:|
|DASH |**Y** |**Y** | - |**Y** |
|HLS |**Y** |**Y** |**Y** ¹ | - |
|MSS | - |**Y** | - | - |

NOTES:
- ¹: By default, FairPlay is handled using Apple's native HLS player, when on
Expand All @@ -211,6 +228,7 @@ Shaka Player supports:
- Can parse "sidx" box for DASH's SegmentBase@indexRange and
SegmentTemplate@index
- Can find and parse "tfdt" box to find segment start time in HLS
- For MSS, [codem-isoboxer][] v0.3.7+ is required
- WebM
- Depends on browser support for the container via MediaSource
- Can parse [cueing data][] elements for DASH's SegmentBase@indexRange and
Expand Down
2 changes: 1 addition & 1 deletion build/misspellings.txt
Expand Up @@ -17,7 +17,7 @@
r'(?i)mananger': 'manager',
r'(?i)mani?fe?st': 'manifest',
r'(?i)mil+isecond': 'millisecond',
r'(?i)oc+ur+(?!ed|ing|ence)': 'occur',
r'(?i)\boc+ur+(?!ed|ing|ence)': 'occur',
r'(?i)oc+ur+(ed|ing|ence)': r'occurr\1',
r'(?i)oc+ur+ance': 'occurrence',
r'(?i)parrent': 'parent',
Expand Down
1 change: 1 addition & 0 deletions build/types/manifests
Expand Up @@ -2,4 +2,5 @@

+@dash
+@hls
+@mss
+@offline
7 changes: 7 additions & 0 deletions build/types/mss
@@ -0,0 +1,7 @@
# The MSS manifest parser plugin.

+../../lib/mss/content_protection.js
+../../lib/mss/mss_parser.js
+../../lib/mss/mss_utils.js

+../../lib/transmuxer/mss_transmuxer.js
10 changes: 10 additions & 0 deletions demo/common/assets.js
Expand Up @@ -141,6 +141,8 @@ shakaAssets.Feature = {
DASH: shakaDemo.MessageIds.DASH,
// Set if the asset is an HLS manifest.
HLS: shakaDemo.MessageIds.HLS,
// Set if the asset is an MSS manifest.
MSS: shakaDemo.MessageIds.MSS,

// Set if the asset has at least one image stream.
THUMBNAILS: shakaDemo.MessageIds.THUMBNAILS,
Expand Down Expand Up @@ -903,6 +905,14 @@ shakaAssets.testAssets = [
.addFeature(shakaAssets.Feature.MP4)
.addFeature(shakaAssets.Feature.LIVE)
.addFeature(shakaAssets.Feature.THUMBNAILS),
new ShakaDemoAssetInfo(
/* name= */ 'Microsoft Smooth Streaming',
/* iconUri= */ 'https://reference.dashif.org/dash.js/latest/samples/lib/img/mss-1.jpg',
/* manifestUri= */ 'https://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism/Manifest',
/* source= */ shakaAssets.Source.DASH_IF)
.addFeature(shakaAssets.Feature.MSS)
.addFeature(shakaAssets.Feature.HIGH_DEFINITION)
.addFeature(shakaAssets.Feature.MP4),
// End DASH-IF Assets }}}

// bitcodin assets {{{
Expand Down
3 changes: 3 additions & 0 deletions demo/common/message_ids.js
Expand Up @@ -21,6 +21,7 @@ shakaDemo.MessageIds = {
LIVE: 'DEMO_LIVE',
MP2TS: 'DEMO_MP2TS',
MP4: 'DEMO_MP4',
MSS: 'DEMO_MSS',
MULTIPLE_LANGUAGES: 'DEMO_MULTIPLE_LANGUAGES',
OFFLINE: 'DEMO_OFFLINE',
STORED: 'DEMO_STORED',
Expand Down Expand Up @@ -86,6 +87,7 @@ shakaDemo.MessageIds = {
UNSUPPORTED_NO_OFFLINE: 'DEMO_UNSUPPORTED_NO_OFFLINE',
UNSUPPORTED_NO_KEY_SUPPORT: 'DEMO_UNSUPPORTED_NO_KEY_SUPPORT',
UNSUPPORTED_NO_LICENSE_SUPPORT: 'DEMO_UNSUPPORTED_NO_LICENSE_SUPPORT',
UNSUPPORTED_NO_MSS_SUPPORT: 'DEMO_UNSUPPORTED_NO_MSS_SUPPORT',
/* Visualizer. */
VISUALIZER_AUTO_SCREENSHOT_TOGGLE: 'DEMO_VISUALIZER_AUTO_SCREENSHOT_TOGGLE',
VISUALIZER_BUTTON: 'DEMO_VISUALIZER_BUTTON',
Expand Down Expand Up @@ -242,6 +244,7 @@ shakaDemo.MessageIds = {
MIN_PIXELS: 'DEMO_MIN_PIXELS',
MIN_TOTAL_BYTES: 'DEMO_MIN_TOTAL_BYTES',
MIN_WIDTH: 'DEMO_MIN_WIDTH',
MSS_SEQUENCE_MODE: 'DEMO_MSS_SEQUENCE_MODE',
NETWORK_INFORMATION: 'DEMO_NETWORK_INFORMATION',
NUMBER_DECIMAL_WARNING: 'DEMO_NUMBER_DECIMAL_WARNING',
NUMBER_INTEGER_WARNING: 'DEMO_NUMBER_INTEGER_WARNING',
Expand Down
4 changes: 3 additions & 1 deletion demo/config.js
Expand Up @@ -254,7 +254,9 @@ shakaDemo.Config = class {
.addBoolInput_(MessageIds.DISABLE_THUMBNAILS,
'manifest.disableThumbnails')
.addBoolInput_(MessageIds.SEGMENT_RELATIVE_VTT_TIMING,
'manifest.segmentRelativeVttTiming');
'manifest.segmentRelativeVttTiming')
.addBoolInput_(MessageIds.MSS_SEQUENCE_MODE,
'manifest.mss.sequenceMode');

this.addRetrySection_('manifest', MessageIds.MANIFEST_RETRY_SECTION_HEADER);
}
Expand Down
2 changes: 2 additions & 0 deletions demo/index.html
Expand Up @@ -38,6 +38,8 @@
<script defer src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"></script>
<!-- transmuxing support is enabled by including this: -->
<script defer src="../node_modules/mux.js/dist/mux.min.js"></script>
<!-- MSS support is enabled by including this: -->
<script defer src="../node_modules/codem-isoboxer/dist/iso_boxer.min.js"></script>
<!-- MPEG-5 Part2 LCEVC support is enabled by including this: -->
<script defer src="../node_modules/lcevc_dil.js/dist/lcevc_dil.min.js"></script>
<!-- MDL is enabled by including this: -->
Expand Down
3 changes: 3 additions & 0 deletions demo/locales/en.json
Expand Up @@ -168,6 +168,8 @@
"DEMO_MIN_WIDTH": "Min Width",
"DEMO_MP2TS": "MPEG-2 TS",
"DEMO_MP4": "MP4",
"DEMO_MSS": "MSS",
"DEMO_MSS_SEQUENCE_MODE": "Enable MSS sequence mode",
"DEMO_MULTIPLE_LANGUAGES": "Multiple languages",
"DEMO_NAME": "Name",
"DEMO_NAME_ERROR": "Must be a unique name.",
Expand Down Expand Up @@ -245,6 +247,7 @@
"DEMO_UNSUPPORTED_NO_HLS_SUPPORT": "Your browser does not support HLS manifests.",
"DEMO_UNSUPPORTED_NO_KEY_SUPPORT": "Your browser does not support the required key systems.",
"DEMO_UNSUPPORTED_NO_LICENSE_SUPPORT": "Your browser does not support offline licenses for the required key systems.",
"DEMO_UNSUPPORTED_NO_MSS_SUPPORT": "Your browser does not support MSS manifests.",
"DEMO_UNSUPPORTED_NO_OFFLINE": "Your browser does not support offline storage.",
"DEMO_UPDATE_EXPIRATION_TIME": "Update expiration time",
"DEMO_UPDATE_INTERVAL_SECONDS": "Update interval seconds",
Expand Down
22 changes: 17 additions & 5 deletions demo/locales/source.json
Expand Up @@ -679,6 +679,14 @@
"description": "Text that describes an asset that uses the MP4 container.",
"message": "[JARGON:MP4]"
},
"DEMO_MSS": {
"description": "Text that describes an asset that is packaged in an MSS manifest.",
"message": "[PROPER_NAME:MSS]"
},
"DEMO_MSS_SEQUENCE_MODE": {
"description": "The name of a configuration value.",
"message": "Enable MSS sequence mode"
},
"DEMO_MULTIPLE_LANGUAGES": {
"description": "A tag that marks an asset as having multiple languages.",
"message": "Multiple languages"
Expand Down Expand Up @@ -960,29 +968,33 @@
"message": "This asset is disabled."
},
"DEMO_UNSUPPORTED_NO_DASH_SUPPORT": {
"description": "An error message that shows why an asset cannot be stored offline: the browser cannot play MPEG-DASH (https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP) content.",
"description": "An error message that shows why an asset cannot be stored or played.",
"message": "Your browser does not support [PROPER_NAME:MPEG-DASH] manifests."
},
"DEMO_UNSUPPORTED_NO_DOWNLOAD": {
"description": "An error message that shows why an asset cannot be stored offline: the asset cannot be downloaded by any browser.",
"description": "An error message that shows why an asset cannot be stored offline: the asset cannot be downloaded.",
"message": "This asset cannot be downloaded."
},
"DEMO_UNSUPPORTED_NO_FORMAT_SUPPORT": {
"description": "An error message that shows why an asset cannot be stored offline: the browser cannot play that sort of video.",
"description": "An error message that shows why an asset cannot be stored or played.",
"message": "Your browser does not support the required video format."
},
"DEMO_UNSUPPORTED_NO_HLS_SUPPORT": {
"description": "An error message that shows why an asset cannot be stored offline: the browser cannot play HLS (https://en.wikipedia.org/wiki/HTTP_Live_Streaming) content.",
"description": "An error message that shows why an asset cannot be stored or played.",
"message": "Your browser does not support [PROPER_NAME:HLS] manifests."
},
"DEMO_UNSUPPORTED_NO_KEY_SUPPORT": {
"description": "An error message that shows why an asset cannot be stored offline: the browser does not support the asset's Digital Rights Management system.",
"description": "An error message that shows why an asset cannot be stored or played.",
"message": "Your browser does not support the required key systems."
},
"DEMO_UNSUPPORTED_NO_LICENSE_SUPPORT": {
"description": "An error message that shows why an asset cannot be stored offline: the browser cannot store protected content offline.",
"message": "Your browser does not support offline licenses for the required key systems."
},
"DEMO_UNSUPPORTED_NO_MSS_SUPPORT": {
"description": "An error message that shows why an asset cannot be stored or played.",
"message": "Your browser does not support [PROPER_NAME:MSS] manifests."
},
"DEMO_UNSUPPORTED_NO_OFFLINE": {
"description": "An error message that shows why an asset cannot be stored offline: the browser does not support storing things offline, in general.",
"message": "Your browser does not support offline storage."
Expand Down
4 changes: 4 additions & 0 deletions demo/main.js
Expand Up @@ -743,6 +743,10 @@ shakaDemo.Main = class {
!this.support_.manifest['m3u8']) {
return shakaDemo.MessageIds.UNSUPPORTED_NO_HLS_SUPPORT;
}
if (asset.features.includes(shakaAssets.Feature.MSS) &&
!this.support_.manifest['ism']) {
return shakaDemo.MessageIds.UNSUPPORTED_NO_MSS_SUPPORT;
}

// Does the asset contain a playable mime type?
const mimeTypes = [];
Expand Down
2 changes: 1 addition & 1 deletion demo/search.js
Expand Up @@ -359,7 +359,7 @@ shakaDemo.Search = class {
/* docLink= */ null);
this.makeSelectInput_(coreContainer,
shakaDemo.MessageIds.MANIFEST_SEARCH,
[Feature.DASH, Feature.HLS], FEATURE);
[Feature.DASH, Feature.HLS, Feature.MSS], FEATURE);
this.makeSelectInput_(coreContainer,
shakaDemo.MessageIds.CONTAINER_SEARCH,
[Feature.MP4, Feature.MP2TS, Feature.WEBM, Feature.CONTAINERLESS],
Expand Down
3 changes: 3 additions & 0 deletions demo/service_worker.js
Expand Up @@ -95,6 +95,9 @@ const OPTIONAL_RESOURCES = [
// The mux.js transmuxing library for MPEG-2 TS and CEA support.
'../node_modules/mux.js/dist/mux.min.js',

// The codem-isoboxer library for MSS support.
'../node_modules/codem-isoboxer/dist/iso_boxer.min.js',

// The cast sender SDK.
'https://www.gstatic.com/cv/js/sender/v1/cast_sender.js',

Expand Down
3 changes: 3 additions & 0 deletions docs/tutorials/upgrade.md
Expand Up @@ -96,3 +96,6 @@ application:
- Configuration changes:
- `streaming.forceTransmuxTS` has been renamed to `streaming.forceTransmux`
(deprecated in v4.3.0)

- Plugin changes:
- `Transmuxer` plugins now has two new parameters in `transmux()` method.

0 comments on commit f80bf20

Please sign in to comment.